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 support for multicast IPv4 TTL and IPv6 hop limit #65886
Add support for multicast IPv4 TTL and IPv6 hop limit #65886
Conversation
feb7192
to
04ff834
Compare
33dc811
to
5d01aff
Compare
As a general note, I originally planned to implement the multicast TTL/hoplimit support only, but noticed that the IPv4 TTL and IPv6 hoplimit were a bit flaky, so the changes are more extensive. We were also missing tests for unicast versions, those + multicast ones are now implemented. |
5d01aff
to
f827cde
Compare
21d5a51
to
a8294f6
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.
Just some doc suggestions to consider, but overall looks good. Shall we mention the API changes in the changelog?
Add option support for adjusting the IPv4 multicast time-to-live value. Fixes zephyrproject-rtos#60299 Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure that setting IPv4 multicast TTL works as expected. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add option support for adjusting the IPv6 multicast multicast hop limit value. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure that setting IPv6 multicast hop limit works as expected. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The net_if_ipv6_set_hop_limit() API was missing the "_if_" part in it. Fix this so that the network interface API is consistent. The old function is deprecated and should not be used. The old function is left to the code and it calls the new properly named function. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add option support for adjusting the IPv6 unicast hop limit value. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
* Check IPv4 TTL or IPv6 hop limit and drop the packet if the value is 0 * Check the IP addresses so that we do the loopback check at runtime if the packet is destined to loopback interface. * Update the statistics properly for dropped packets. * Do not update sent packets if we drop packets. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure packet is dropped if TTL 0 packet is tried to send. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure packet is dropped if IPv6 hop limit 0 packet is tried to send. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Make sure that statistics is properly update for dropped packets when IPv4 TTL is 0 or IPv6 hop limit is 0. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We specifically set TTL/hoplimit to 1 for LLMNR, but only want to set it if in that specific case. We must not pass TTL/hoplimit value 0 as that would cause the packet to be dropped. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We are creating a multicast address in mDNS or LLMNR responder so set the TTL or hoplimit using the multicast variant API. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
We need to use multicast TTL/hoplimit instead of unicast one in the test. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
a8294f6
to
fbe3c71
Compare
Minor tweaks to kconfig file. Added also info to migration guide. |
e5d05fd
to
5e710a9
Compare
Add information about IPv4 TTL and IPv6 hoplimit changes for unicast and multicast packets. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add information about IPv4 TTL and IPv6 hoplimit changes for unicast and multicast packets. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
5e710a9
to
bb027e5
Compare
Release and migration note changes in this 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.
Just noticed missing Doxygen comments -- not making this blocking as I don't necessarily want to slow you guys down as I trust you'll address this in a follow-up PR, but would still be nice to have I think, especially since the networking headers are usually pretty well documented, so would be good to keep the track record ;-)
https://builds.zephyrproject.io/zephyr/pr/65886/api-coverage/zephyr/net/index.html
@@ -703,6 +709,17 @@ static inline void net_context_set_ipv4_ttl(struct net_context *context, | |||
context->ipv4_ttl = ttl; | |||
} | |||
|
|||
static inline uint8_t net_context_get_ipv4_mcast_ttl(struct net_context *context) |
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.
there are quite a few of these net_context_get|set_*
functions (existing ones, and the ones you added) that are missing doxygen comments. Could you please add them? Should these be considered internal (I have no idea myself :)) you may consider not having the doxygen documentation (although it's always nice to have imo), and simply enclose them in @cond INTERNAL_HIDDEN
sections.
Sorry that I didn't notice earlier as I really just paid attention to the migration guide changes when the bot added me.
struct { | ||
uint8_t ipv6_hop_limit; | ||
uint8_t ipv6_mcast_hop_limit; | ||
}; | ||
struct { | ||
uint8_t ipv4_ttl; | ||
uint8_t ipv4_mcast_ttl; | ||
}; |
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 be nice to have doxygen comments here as well (again, unless this is something you want to hide from the public API).
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.
Sure, I will submit a follow up pr adding more comments. Thx!
Add option support for adjusting the IPv4 multicast time-to-live value. Add also tests for both unicast and multicast TTL settings.
Add also similar IPv6 hop limit option for both unicast and multicast IPv6 packets + tests.
Add checks and tests for IPv4 TTL 0 or IPv6 hop limit 0 when sending packet, the packet should dropped in this case.
Fixes #60299