lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 23 Mar 2013 16:36:09 -0700 From: Pravin Shelar <pshelar@...ira.com> To: Cong Wang <amwang@...hat.com> Cc: netdev@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>, "David S. Miller" <davem@...emloft.net> Subject: Re: [PATCH net-next] ip_gre: increase inner ip header ID only for IPv4 On Fri, Mar 22, 2013 at 10:29 PM, Cong Wang <amwang@...hat.com> wrote: > From: Cong Wang <amwang@...hat.com> > > Pravin pointed out the inner network header of a GRE tunnel packet > could be IPv6, where there is no ID. So we should check the version. > inet_gso_segment() already increment ip-header identification. What is problem with that? > Cc: Pravin B Shelar <pshelar@...ira.com> > Cc: Eric Dumazet <edumazet@...gle.com> > Cc: "David S. Miller" <davem@...emloft.net> > Signed-off-by: Cong Wang <amwang@...hat.com> > > --- > diff --git a/net/ipv4/gre.c b/net/ipv4/gre.c > index e20631c..a2516f5 100644 > --- a/net/ipv4/gre.c > +++ b/net/ipv4/gre.c > @@ -128,7 +128,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, > struct iphdr *iph; > int mac_len = skb->mac_len; > int tnl_hlen, id; > - bool csum; > + bool csum, ipv4; > > if (unlikely(skb_shinfo(skb)->gso_type & > ~(SKB_GSO_TCPV4 | > @@ -172,7 +172,12 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, > skb->mac_len = skb_inner_network_offset(skb); > > iph = ip_hdr(skb); > - id = ntohs(iph->id); > + if (iph->version == 4) { > + ipv4 = true; > + id = ntohs(iph->id); > + } else > + ipv4 = false; > + > /* segment inner packet. */ > enc_features = skb->dev->hw_enc_features & netif_skb_features(skb); > segs = skb_mac_gso_segment(skb, enc_features); > @@ -182,8 +187,10 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, > skb = segs; > tnl_hlen = skb_tnl_header_len(skb); > do { > - iph = (struct iphdr *)skb->data; > - iph->id = htons(id++); > + if (ipv4) { > + iph = (struct iphdr *)skb->data; > + iph->id = htons(id++); > + } > __skb_push(skb, ghl); > if (csum) { > __be32 *pcsum; -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists