Skip to content
Permalink
Browse files

net: ipv6: Fix fragmentation

The next header was not properly set in the de-fragmented
packet.

Fixes #16354

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information...
jukkar committed Jul 12, 2019
1 parent 0ec4341 commit ccba1036c5201dce843cd08855b611d4536bc7ce
Showing with 9 additions and 3 deletions.
  1. +7 −2 subsys/net/ip/ipv6.c
  2. +2 −1 subsys/net/ip/ipv6_fragment.c
@@ -356,7 +356,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback)
int real_len = net_pkt_get_len(pkt);
u8_t ext_bitmap = 0U;
u16_t ext_len = 0U;
u8_t nexthdr, next_nexthdr;
u8_t nexthdr, next_nexthdr, prev_hdr_offset;
union net_proto_header proto_hdr;
struct net_ipv6_hdr *hdr;
union net_ip_header ip;
@@ -443,6 +443,8 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback)
net_pkt_acknowledge_data(pkt, &ipv6_access);

nexthdr = hdr->nexthdr;
prev_hdr_offset = (u8_t *)&hdr->nexthdr - (u8_t *)hdr;

while (!net_ipv6_is_nexthdr_upper_layer(nexthdr)) {
int exthdr_len;

@@ -484,8 +486,11 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback)

case NET_IPV6_NEXTHDR_FRAG:
if (IS_ENABLED(CONFIG_NET_IPV6_FRAGMENT)) {
net_pkt_set_ipv6_hdr_prev(pkt,
prev_hdr_offset);
net_pkt_set_ipv6_fragment_start(
pkt, net_pkt_get_current_offset(pkt));
pkt,
net_pkt_get_current_offset(pkt) - 1);
return net_ipv6_handle_fragment_hdr(pkt, hdr,
nexthdr);
}
@@ -250,6 +250,8 @@ static void reassemble_packet(struct net_ipv6_reassembly *reass)

pkt = reass->pkt[i];

net_pkt_cursor_init(pkt);

/* Get rid of IPv6 and fragment header which are at
* the beginning of the fragment.
*/
@@ -317,7 +319,6 @@ static void reassemble_packet(struct net_ipv6_reassembly *reass)
goto error;
}


/* Fix the total length of the IPv6 packet. */
len = net_pkt_ipv6_ext_len(pkt);
if (len > 0) {

0 comments on commit ccba103

Please sign in to comment.
You can’t perform that action at this time.