Repository navigation
Conversation
Revision history
Generated by jj-stack from this pull request's force-push history. |
543da50 to
9d83e29
Compare
0bf3422 to
109cc76
Compare
d1ff6f0 to
1abfb30
Compare
1abfb30 to
b431f3f
Compare
b431f3f to
519832a
Compare
| } | ||
|
|
||
| #[cfg(any(target_os = "linux", target_os = "illumos"))] | ||
| fn get_sockopt( |
There was a problem hiding this comment.
Should this be
get_sockopt<T>(...) -> Result<T, Error> { ... }There was a problem hiding this comment.
Initially I had thought so too, but getsockopt(2) always returns int so there's no need for generics. I made set_sockopt generic so that plain Rust refs can be passed in without forcing the caller to cast it to a c_void pointer ahead of time
There was a problem hiding this comment.
I don't think thats right for illumos getsockopt(3socket), perhaps on linux. For example, IPV6_NEXTHOP and IPV6_PATHMTU return structs.
There was a problem hiding this comment.
Ah, yeah ok. I was looking at the C return type and overlooked the void pointer passed in for the kernel to write to
There was a problem hiding this comment.
I've pushed a change (it's force-pushed, sorry... the diff is here) that addresses this, adds some safety comments, and adds in the round-trip socket option tests that I'd started playing with for a different branch a while back.
Assuming the ipv4-mapped sockopts work in whatever helios version CI runs, the tests should all pass and we'll have actual regression coverage.
519832a to
030c409
Compare
030c409 to
3735cc0
Compare
3735cc0 to
60264fc
Compare
60264fc to
9678231
Compare
9678231 to
fd1f122
Compare
fd1f122 to
04b1453
Compare
04b1453 to
bbea8da
Compare
bbea8da to
b621dc0
Compare
b621dc0 to
aabfeed
Compare
aabfeed to
db96ca8
Compare
cabb066 to
21947ea
Compare
Instead of jamming unsafe calls to libc::{get,set}sockopt, centralize it
to just one wrapper for each method and use option-specific wrappers.
Also fix incorrect sockopt name for IPv6 TTL:
IP_MINTTL -> IPV6_MINHOPCOUNT
Fixes: #647
Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
21947ea to
99e826f
Compare
Instead of jamming unsafe calls to libc::{get,set}sockopt, centralize it to just one wrapper for each method and use option-specific wrappers.
Also fix incorrect sockopt name for IPv6 TTL: IP_MINTTL -> IPV6_MINHOPCOUNT
Fixes: #647
Signed-off-by: Trey Aspelund trey@oxidecomputer.com