-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement total Show functions for SockAddr #441
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree to throw away getNameInfo
for this purpose.
- Would you start with a test case of multicast address which fails on macOS?
- Then, add your fix code. Unfortunately, @vdukhovni improved the code of
iproute
recently. So, please check it out on github.
You can use push -f
for this PR as you like.
The previous implementation of show used unsafePerformIO and getNameInfo. getNameInfo depends on show SockAddr incase of a failure. The showHostAddress and showHostAddress6 are based on showIPv4 and showIPv6 in the iproute package.
5dcd18c
to
cabc788
Compare
@kazu-yamamoto I've added test cases for
without my patch.
From what I can see @vdukhovni's changes did not affect the show functions for IPv4 and IPv6 addresses. |
That's correct, I only changed the various getters and setters for the binary forms. |
@karknu @vdukhovni Thank you for clarification. This PR now looks great. Rebased and merged. Thank you for your contribution! It would be nice if we implemented |
The previous implementation of show
SockAddr
usedunsafePerformIO
andgetNameInfo
.getNameInfo
depends on showSockAddr
in case of a failure which causes exceptions within exceptions within exceptions...This is not just a theoretical problem. It is possible to get
getnameinfo
to fail on OSX using a multicast address with a reserved scope. This is because OSX attempts to map the second 16 bit word of an IPv6 address to a device name.Example from C's
getnameinfo
:The showHostAddress and showHostAddress6 are based on showIPv4 and
showIPv6 in the iproute package.