-
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
fix: send ETH_P_ALL in htons format #1925
Conversation
This was required in my testing on Linux at least. I think the other values need the same treatment, but didn't want to change them as I didn't test on the other platforms. |
a10636b
to
dacc6b5
Compare
src/sys/socket/mod.rs
Outdated
@@ -217,7 +224,7 @@ pub enum SockProtocol { | |||
// The protocol number is fed into the socket syscall in network byte order. | |||
#[cfg(any(target_os = "android", target_os = "linux"))] | |||
#[cfg_attr(docsrs, doc(cfg(all())))] | |||
EthAll = libc::ETH_P_ALL.to_be(), | |||
EthAll = htons_i32(libc::ETH_P_ALL), |
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.
Would this work instead? It's a little bit simpler to inline it.
EthAll = htons_i32(libc::ETH_P_ALL), | |
EthAll = (libc::ETH_P_ALL as u16).to_be() as i32, |
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 it works the same, but it's a const fn
so it's evaluated at compile time and won't require inlining, or did you just mean it's simpler to not have the function?
Happy to do it either way, but I think the other values need the same treatment on Linux, I just hadn't tested that far.
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.
Oh! It would really help if you could test them too. I suggested inlining that function just for readability's sake.
Any status updates on this? Attaching this relevant Rust forums post that looks into some of the issues occurring from this. I can confirm this fixes the mentioned issue. |
dacc6b5
to
f3bf1b9
Compare
From what I can tell, just the other |
@tzneal are you going to inline that function like I suggested? And this needs a CHANGELOG, too. |
f3bf1b9
to
06eb8ff
Compare
Yeah I can, I was going to leave it for the next |
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+
1925: fix: send ETH_P_ALL in htons format r=asomers a=tzneal Co-authored-by: Todd Neal <[email protected]>
1925: fix: send ETH_P_ALL in htons format r=asomers a=tzneal Co-authored-by: Todd Neal <[email protected]>
No description provided.