Implement {netns,NS} option for inet:getifaddrs/1 and friends #1974
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds namespace support to
inet:getifaddrs/and friends.The namespace option is as far as I know only valid on Linux that has got a
setns()OS API function.This PR changes the signature of the previously undocumented function
inet:getifaddrs/1to accept an option list [{netns,NS}]. Before this change it accepted a port that is an UDP socket that was used to accessinet_drv.c, and it was an internal function not used anywhere in OTP.A question is whether to keep the legacy function variant. Has anyone used it?
I think it is safest to keep the legacy function variant. I changed the documentation format to the style not using the type spec, and thereby I could document only the new option list variant. The type spec specifies the complete implemented function, though.
Some more undocumented functions that is
inet:getif/1,getiflist/1,ifget/2,ifset/2were changed in the process, for completeness...