-
Notifications
You must be signed in to change notification settings - Fork 2.1k
gnrc_ipv6: assume no preparsed packets #10233
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
gnrc_ipv6: assume no preparsed packets #10233
Conversation
b5d3471
to
eee483e
Compare
@@ -703,7 +703,7 @@ static inline bool _pkt_not_for_me(gnrc_netif_t **netif, ipv6_hdr_t *hdr) | |||
static void _receive(gnrc_pktsnip_t *pkt) | |||
{ | |||
gnrc_netif_t *netif = NULL; | |||
gnrc_pktsnip_t *ipv6, *netif_hdr, *first_ext; |
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.
Due to pkt
now only consisting of the IPv6 header (and possibly the netif
header), with the IPv6 header later being marked (i.e. the packet becomes payload -> ipv6 -> netif
), first_ext
became only an alias for pkt
and this unnecessary.
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
a943d97
to
3a564fb
Compare
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
b0d3dca
to
36f6265
Compare
Rebased to current #10229. |
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
36f6265
to
e9b1aef
Compare
Rebased to current #10229. |
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
Reminder to self: adapt for ugly bugfix in #10246. |
3208262
to
bea82a9
Compare
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
bea82a9
to
8ed76a8
Compare
Rebased to current #10229. |
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
Since the packet is now guaranteed to be preparsed, the currently handled IPv6 header will always be in the first snip. Because of this the packet parser can't get confused anymore which IPv6 header is the one to be handled so we don't need to remove the more outer ones. Because of this we can just use the normal packet dispatching (which is already used by other `GNRC_NETTYPE_*`-known protocol numbers such as UDP). This also reverts d54ac38.
8ed76a8
to
3fde0ef
Compare
Rebased to current master. No longer waiting on other PR. |
Tested with the described procedure (and also with the one in #10229 ) |
nothing interesting to report on coding style and documentation doesn't apply here |
btw it reduces around 800 bytes on samr21-xpro when rebased to master :) |
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.
ACK
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
Since with RIOT-OS#10233 we now assume IPv6 packets always to not be pre-parsed, we can iterate over the extension headers by gradually "eating" them away. This allows us to move the iteration over them out of `gnrc_ipv6_ext_demux()` and into `gnrc_ipv6_demux()`. By moving the iteration over all extension headers out of `gnrc_ipv6_ext_demux()` we also can 1. simplify the extension header handling a lot, as it now just a loop inside `gnrc_ipv6_demux()`, 2. remove the recursion to `gnrc_ipv6_demux()` within `gnrc_ipv6_ext_demux()`.
Contribution description
As stated in #10229, with #9484 and #10229 we don't have to assume anymore that an IPv6 packet was preparsed before it is handed to IPv6's receive routine. This allows us to remove a whole chunk of code.
Further simplifications not related to finding the IPv6 header in a preparsed packet will follow later.
Testing procedure
Compile
gnrc_networking
for a IEEE802.15.4-equipped board of your choice and flash. Try to send IPHC-compressed UDP packets and fragmented packets. All should be received and handled correctly. Here is what I did to test (oniotlab-m3
:Also repeat testing proceedures from #10229.
Issues/PRs references
Depends on
#10229 (and its dependencies)(merged).