Skip to content

Commit c71644d

Browse files
skorpion17davem330
authored andcommitted
seg6: fix skb transport_header after decap_and_validate()
in the receive path (more precisely in ip6_rcv_core()) the skb->transport_header is set to skb->network_header + sizeof(*hdr). As a consequence, after routing operations, destination input expects to find skb->transport_header correctly set to the next protocol (or extension header) that follows the network protocol. However, decap behaviors (DX*, DT*) remove the outer IPv6 and SRH extension and do not set again the skb->transport_header pointer correctly. For this reason, the patch sets the skb->transport_header to the skb->network_header + sizeof(hdr) in each DX* and DT* behavior. Signed-off-by: Andrea Mayer <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7f91ed8 commit c71644d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/ipv6/seg6_local.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ static int input_action_end_dx6(struct sk_buff *skb,
341341
if (!ipv6_addr_any(&slwt->nh6))
342342
nhaddr = &slwt->nh6;
343343

344+
skb_set_transport_header(skb, sizeof(struct ipv6hdr));
345+
344346
seg6_lookup_nexthop(skb, nhaddr, 0);
345347

346348
return dst_input(skb);
@@ -370,6 +372,8 @@ static int input_action_end_dx4(struct sk_buff *skb,
370372

371373
skb_dst_drop(skb);
372374

375+
skb_set_transport_header(skb, sizeof(struct iphdr));
376+
373377
err = ip_route_input(skb, nhaddr, iph->saddr, 0, skb->dev);
374378
if (err)
375379
goto drop;
@@ -390,6 +394,8 @@ static int input_action_end_dt6(struct sk_buff *skb,
390394
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
391395
goto drop;
392396

397+
skb_set_transport_header(skb, sizeof(struct ipv6hdr));
398+
393399
seg6_lookup_nexthop(skb, NULL, slwt->table);
394400

395401
return dst_input(skb);

0 commit comments

Comments
 (0)