-
Notifications
You must be signed in to change notification settings - Fork 681
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
Add routing socket type on macOS #1867
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 think this is reasonable. But how does one use a routing socket? Do you need to bind
and/or connect
with it? If so, then Nix support won't be complete without those. Also, it needs a CHANGELOG entry.
There's no reason to Having used this for a bit, it seems that there are also some |
I now realize that these changes might also be relevant for FreeBSD and friends - but I don't have a FreeBSD VM handy to test my changes. |
9eabdf0
to
7d4bc14
Compare
It looks to me like you should enable this for macos, ios, freebsd, dragonfly, openbsd, netbsd, linux, android, illumos, haiku, and fuchsia. In fact, it's everywhere but Redox. But on Linux and Android, it's an alias for AF_NETLINK. Why don't you try enabling it for all of those, and let CI test it for you? We have full testing in CI for FreeBSD, OSX, and Linux. |
158da17
to
14e6451
Compare
It seems that it does just work on most OS'es. I elected to not define it on Linux, since the same value is already used for netlink sockets (and they are kind of the same kind of a thing). Should I remove the test that tries to open the routing socket, or should that stay? I think it doesn't really test any logic, just that a socket of this type can be opened. |
I think it's ok to leave the test. It helps us validate which platforms have routing sockets. I'll create another PR to fix the clippy failure. |
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.
The CI failure on uclibc is fixed on master.
bors r+
Merge conflict. |
14e6451
to
6a62210
Compare
I've rebased and it passes all the checks now. |
CHANGELOG.md
Outdated
@@ -22,6 +22,9 @@ This project adheres to [Semantic Versioning](https://semver.org/). | |||
- Added `MntFlags` and `unmount` on all of the BSDs. | |||
- Added `any()` and `all()` to `poll::PollFd`. | |||
([#1877](https://github.com/nix-rust/nix/pull/1877)) | |||
- Add `PF_ROUTE` to `SockType` on macOS. | |||
- Add `PF_ROUTE` to `SockType` on macOS, all of the BSDs and Linux. |
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.
This is incorrect, because you didn't add it to Linux.
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.
Ah, you are right. I've updated it now and I do apologize for the sloppy push.
6a62210
to
03ec537
Compare
CHANGELOG.md
Outdated
@@ -22,6 +22,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). | |||
- Added `MntFlags` and `unmount` on all of the BSDs. | |||
- Added `any()` and `all()` to `poll::PollFd`. | |||
([#1877](https://github.com/nix-rust/nix/pull/1877)) | |||
- Add `PF_ROUTE` to `SockType` on macOS, all of the BSDs. |
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.
- Add `PF_ROUTE` to `SockType` on macOS, all of the BSDs. | |
- Add `PF_ROUTE` to `SockType` on macOS and the BSDs. |
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.
But isn't this still inaccurate? Because you also added it for iOS, illumos, Haiku, and Fuchsia, I believe.
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.
You are correct, I also moved the entry up the changelog, since these changes have not been released anywhere yet.
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 think you forgot to push?
03ec537
to
1a8e575
Compare
1a8e575
to
d08d4e2
Compare
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.
bors r+
@asomers Would you be able to cut a release that includes this patch? We're relying on it now but would like to get rid of the git dependency. |
This is a small change to add the routing socket type to the list of socket types one can open with
nix
. I've added a smoke test to see that a socket of such type can actually be opened, but I'm not sure if such a test belongs in the codebase here.