Skip to content
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

nix::sys::socket::sockopt::OriginalDst does not support ipv6 #938

Open
yangzhaofeng opened this issue Aug 22, 2018 · 3 comments
Open

nix::sys::socket::sockopt::OriginalDst does not support ipv6 #938

yangzhaofeng opened this issue Aug 22, 2018 · 3 comments

Comments

@yangzhaofeng
Copy link

I tried to get the ipv6 address of accessor, but GetSockOpt for OriginalDst only supports ipv4. Can you add ipv6 support?
Or is there any substitute?

@asomers
Copy link
Member

asomers commented Aug 22, 2018

Unfortunately SO_ORIGINAL_DST is undocumented in Linux. I don't know if Linux even supports it for IPv6 sockets. If you can find documentation that says Linux does, then we can add IPv6 support for it to Nix.

But as for your immediate problem, have you considered whether getsockname or getpeername will work?

@yangzhaofeng
Copy link
Author

No.
Argument type for the two functions is fd: RawFd which means int32 . However, ipv6 address is int128 .
It seems that many functions in nix::sys::socket may have this problem.

BTW, the code with problem is here

@asomers
Copy link
Member

asomers commented Aug 23, 2018

A variable of type RawFd should never be used to hold an IP address! It's for file descriptors. Those two functions return SockAddr, which may be IPv4 or IPv6.

bors bot added a commit that referenced this issue Aug 18, 2021
1490: add libc::IP6T_SO_ORIGINAL_DST to socket opt r=asomers a=bearice

the original PR #1410 was stalled for a while
let's make it happen.

this should closes #1410 and #938

Co-authored-by: Icemic <bingfeng.web@gmail.com>
Co-authored-by: Bearice Ren <bearice@icybear.net>
bors bot added a commit that referenced this issue Aug 18, 2021
1490: add libc::IP6T_SO_ORIGINAL_DST to socket opt r=asomers a=bearice

the original PR #1410 was stalled for a while
let's make it happen.

this should closes #1410 and #938

Co-authored-by: Icemic <bingfeng.web@gmail.com>
Co-authored-by: Bearice Ren <bearice@icybear.net>
bors bot added a commit that referenced this issue Aug 18, 2021
1486: Relax assertions in sockaddr_storage_to_addr to match the documentation. r=asomers a=khuey

Fixes #1479

1490: add libc::IP6T_SO_ORIGINAL_DST to socket opt r=asomers a=bearice

the original PR #1410 was stalled for a while
let's make it happen.

this should closes #1410 and #938

1493: Fix crates.io badge r=asomers a=atouchet



Co-authored-by: Kyle Huey <khuey@kylehuey.com>
Co-authored-by: Icemic <bingfeng.web@gmail.com>
Co-authored-by: Bearice Ren <bearice@icybear.net>
Co-authored-by: Alex Touchet <alextouchet@outlook.com>
bors bot added a commit that referenced this issue Aug 18, 2021
1490: add libc::IP6T_SO_ORIGINAL_DST to socket opt r=asomers a=bearice

the original PR #1410 was stalled for a while
let's make it happen.

this should closes #1410 and #938

1493: Fix crates.io badge r=asomers a=atouchet



Co-authored-by: Icemic <bingfeng.web@gmail.com>
Co-authored-by: Bearice Ren <bearice@icybear.net>
Co-authored-by: Alex Touchet <alextouchet@outlook.com>
bors bot added a commit that referenced this issue Aug 18, 2021
1490: add libc::IP6T_SO_ORIGINAL_DST to socket opt r=asomers a=bearice

the original PR #1410 was stalled for a while
let's make it happen.

this should closes #1410 and #938

Co-authored-by: Icemic <bingfeng.web@gmail.com>
Co-authored-by: Bearice Ren <bearice@icybear.net>
bors bot added a commit that referenced this issue Aug 18, 2021
1486: Relax assertions in sockaddr_storage_to_addr to match the documentation. r=asomers a=khuey

Fixes #1479

1490: add libc::IP6T_SO_ORIGINAL_DST to socket opt r=asomers a=bearice

the original PR #1410 was stalled for a while
let's make it happen.

this should closes #1410 and #938

1493: Fix crates.io badge r=asomers a=atouchet



Co-authored-by: Kyle Huey <khuey@kylehuey.com>
Co-authored-by: Icemic <bingfeng.web@gmail.com>
Co-authored-by: Bearice Ren <bearice@icybear.net>
Co-authored-by: Alex Touchet <alextouchet@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants