Skip to content

Commit

Permalink
net: pkt: Allow larger packets for IPv6 fragmentation
Browse files Browse the repository at this point in the history
If the allocated net_pkt is larger than the network interface MTU,
then check if the IPv6 fragmentation is enabled and allow larger
net_pkt length as the IPv6 fragmentation will split the packet into
suitable parts.

Fixes #16354

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information
jukkar committed Jul 23, 2019
1 parent ccba103 commit aaafb6a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions subsys/net/ip/net_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,13 @@ static size_t pkt_buffer_length(struct net_pkt *pkt,

/* Family vs iface MTU */
if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) {
if (IS_ENABLED(CONFIG_NET_IPV6_FRAGMENT) && (size > max_len)) {
/* We support larger packets if IPv6 fragmentation is
* enabled.
*/
max_len = size;
}

max_len = MAX(max_len, NET_IPV6_MTU);
} else if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) {
max_len = MAX(max_len, NET_IPV4_MTU);
Expand Down

0 comments on commit aaafb6a

Please sign in to comment.