Skip to content

Commit

Permalink
ipv6: sr: clear IP6CB(skb) on SRH ip4ip6 encapsulation
Browse files Browse the repository at this point in the history
skb->cb may contain data from previous layers (in an observed case
IPv4 with L3 Master Device). In the observed scenario, the data in
IPCB(skb)->frags was misinterpreted as IP6CB(skb)->frag_max_size,
eventually caused an unexpected IPv6 fragmentation in ip6_fragment()
through ip6_finish_output().

This patch clears IP6CB(skb), which potentially contains garbage data,
on the SRH ip4ip6 encapsulation.

Fixes: 32d99d0 ("ipv6: sr: add support for ip4ip6 encapsulation")
Signed-off-by: Yohei Kanemaru <yohei.kanemaru@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
yunazuno authored and davem330 committed Jan 30, 2019
1 parent a10cc84 commit ef48974
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ipv6/seg6_iptunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, int proto)
} else {
ip6_flow_hdr(hdr, 0, flowlabel);
hdr->hop_limit = ip6_dst_hoplimit(skb_dst(skb));

memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
}

hdr->nexthdr = NEXTHDR_ROUTING;
Expand Down

0 comments on commit ef48974

Please sign in to comment.