Skip to content

macOS: Add getsockopt for (libc::SYSPROTO_CONTROL, libc::UTUN_OPT_IFNAME) #867

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

Conversation

kristate
Copy link

Adds getsockopt implementation for (libc::SYSPROTO_CONTROL, libc::UTUN_OPT_IFNAME).

Usage

getsockopt(fd, SYSPROTO_CONTROL, UTUN_OPT_IFNAME, name, len) is used to get the interface name of the connected tunnel adapter. Usually returns utun followed by the interface number.

On macOS / iOS, to get the IFNAME of a UTUN, a `getsockopt(fd, SYSPROTO_CONTROL, UTUN_OPT_IFNAME, val, len);` call must be made passing not a struct, but a CString of `IFNAMSIZ` bytes, which returns how many bytes of the CString was written to (including with null-terminating byte).

This implements getsockopt for bytes.
…O_CONTROL, UTUN_OPT_IFNAME, val, len);`; depends on ref nix-rust#866
@kristate kristate mentioned this pull request Feb 25, 2018
3 tasks
@asomers
Copy link
Member

asomers commented Apr 28, 2018

This is weird enough that I don't want to merge it without a test. It's ok if the test requires root access. We already have some like that, for example test_setgroups.

@SteveLauC
Copy link
Member

Close as superseded by #2325

@SteveLauC SteveLauC closed this Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants