Skip to content

Commit e84fa0a

Browse files
committed
Merge branch 'seg6-fixes-to-Segment-Routing-in-IPv6'
Andrea Mayer says: ==================== seg6: fixes to Segment Routing in IPv6 This patchset is divided in 2 patches and it introduces some fixes to Segment Routing in IPv6, which are: - in function get_srh() fix the srh pointer after calling pskb_may_pull(); - fix the skb->transport_header after calling decap_and_validate() function; Any comments on the patchset are welcome. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents acb9bdc + c71644d commit e84fa0a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

net/ipv6/seg6_local.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ static struct ipv6_sr_hdr *get_srh(struct sk_buff *skb)
8181
if (!pskb_may_pull(skb, srhoff + len))
8282
return NULL;
8383

84+
/* note that pskb_may_pull may change pointers in header;
85+
* for this reason it is necessary to reload them when needed.
86+
*/
87+
srh = (struct ipv6_sr_hdr *)(skb->data + srhoff);
88+
8489
if (!seg6_validate_srh(srh, len))
8590
return NULL;
8691

@@ -336,6 +341,8 @@ static int input_action_end_dx6(struct sk_buff *skb,
336341
if (!ipv6_addr_any(&slwt->nh6))
337342
nhaddr = &slwt->nh6;
338343

344+
skb_set_transport_header(skb, sizeof(struct ipv6hdr));
345+
339346
seg6_lookup_nexthop(skb, nhaddr, 0);
340347

341348
return dst_input(skb);
@@ -365,6 +372,8 @@ static int input_action_end_dx4(struct sk_buff *skb,
365372

366373
skb_dst_drop(skb);
367374

375+
skb_set_transport_header(skb, sizeof(struct iphdr));
376+
368377
err = ip_route_input(skb, nhaddr, iph->saddr, 0, skb->dev);
369378
if (err)
370379
goto drop;
@@ -385,6 +394,8 @@ static int input_action_end_dt6(struct sk_buff *skb,
385394
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
386395
goto drop;
387396

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

390401
return dst_input(skb);

0 commit comments

Comments
 (0)