On Tue, Nov 6, 2018 at 2:41 PM David Miller <da...@davemloft.net> wrote: > > From: Eric Dumazet <eduma...@google.com> > Date: Tue, 6 Nov 2018 14:25:52 -0800 > > > + if (unlikely(nlen > sizeof(struct ipv6hdr))) { > > + if (memcmp(iph + 1, iph2 + 1, > > + nlen - sizeof(struct ipv6hdr))) > > + goto not_same_flow; > > + } > > Is this even possible?
I believe that nlen can be indeed > sizeof(struct ipv6hdr) in presence of exthdrs, eg if ipv6_gso_pull_exthdrs() had to be called (line 201) I admit I have not checked if this was actually possible. > > off = skb_gro_offset(skb); > hlen = off + sizeof(*iph); > iph = skb_gro_header_fast(skb, off); > > off is some offset to the ipv6hdr in skb. This is GRO's CB data_offset. > > skb_set_network_header(skb, off); > skb_gro_pull(skb, sizeof(*iph)); > skb_set_transport_header(skb, skb_gro_offset(skb)); > > Set network header to location of iph in SKB. > > GRO pull causes an incremebt of data_offset by sizeof(*iph) bytes. > > Set transport header to new data_offset value. > > nlen = skb_network_header_len(skb); > > This is transport_header - network_header. > > From what I can see, it is impossible for this to take on any value > other than sizeof(*ipv6hdr). > > If you agree, please let's get rid of nlen and this useless code, and > replace with sizeof(*ipv6hdr) as needed. > > Thanks.