-
Notifications
You must be signed in to change notification settings - Fork 60
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 UDP multicast simulation #223
Conversation
770edf2
to
7ae915a
Compare
b71e108
to
c4e3d0d
Compare
I’ve fixed clippy warnings and simplified tests for leaving multicast group. |
c0dcf7d
to
1d2ee20
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.
Core approach seems reasonable to me.
Mostly my comments were nits around clarity of error messages and/or doc comments. Take them or leave them, none are blocking.
The only substantive thing I have questions about is, why aren't we verifying the bind addresses for ipv6 (only for ipv4 currently)?
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.
Thanks for fixing all the nits.
Had a follow-up question on the verify_*_bind_interface
method, sorry for the churn
Ok(()) | ||
} | ||
|
||
fn verify_ipv6_bind_interface(interface: u32) -> Result<()> { |
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.
Is there a reason this can't just be combined into a verify_bind_interface
check? Given that we are already using it to verify ipv6 for the bind()
method? Anyway we still want to validate the protocol version matches? And we still want to validate that the interface is unspecified or loopback since Turmoil isn't doing anything with them so accepting anything else would be misleading callers?
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 believe there are few reasons why we can’t combine those functions. I've changed argument names of the verify_ipv4_bind_interface()
to make that clear.
The first argument of the verify_ipv4_bind_interface()
function is an interface
address. We verify that it is unspecified or loopback, and test the fact that its protocol version matches the protocol version of the second argument, which is destination address (or host address, different names for the same address). We do not test the second argument (destination address).
The first argument of verify_ipv6_bind_interface()
function has type u32
. It’s not an IP address. We can’t test it for being unspecified or loopback, or for protocol version.
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.
IE, I'm having trouble understanding enforcing 0 rather than the Ipv6Addr::UNSPECIFIED
or Ipv6Addr::LOCALHOST
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, comment race, sorry... digesting your response, thanks
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.
Thanks for your clarification. I see, the APIs are just different across ipv4 and ipv6 for UDP socket - https://doc.rust-lang.org/std/net/struct.UdpSocket.html#method.join_multicast_v6
The address must be a valid multicast address, and interface is the index of the interface to join/leave (or 0 to indicate any interface).
A bit awkward, but totally outside of the scope of this CR. Your decision makes sense in that context, thanks for your patience.
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've changed argument names of the verify_ipv4_bind_interface() to make that clear.
Thanks for this change, added clarity
Thanks for the quick turnaround on review feedback! Will move conversation back to the issue: #208 |
No description provided.