Hi, On Thu, 12 May 2016 14:45:36 -0700 Tom Herbert <t...@herbertland.com> wrote: > On Thu, May 12, 2016 at 1:23 PM, Shmulik Ladkani > <shmulik.ladk...@gmail.com> wrote: > >> @@ -222,13 +222,14 @@ static int ip6_input_finish(struct net *net, struct > >> sock *sk, struct sk_buff *sk > >> */ > >> > >> rcu_read_lock(); > >> -resubmit: > >> + > >> idev = ip6_dst_idev(skb_dst(skb)); > >> if (!pskb_pull(skb, skb_transport_offset(skb))) > >> goto discard; > >> nhoff = IP6CB(skb)->nhoff; > >> nexthdr = skb_network_header(skb)[nhoff]; > >> > >> +resubmit: > > > > This has already been attempted in 0243508edd "ipv6: Fix protocol > > resubmission" and reverted in 1b0ccfe54a. > > > > It looks that in some genuine extension header handling cases of ipv6 > > (not related to encapsulation), the original resubmission code REALLY > > requires one to re-read IP6CB(skb)->nhoff and refetch the nexthdr. > > > Is there any reason why the EH handlers can't read the nexthdr and return > that?
One additional thing: Seems the if (!pskb_pull(skb, skb_transport_offset(skb))) located at the original resubmit label was also necessary, as the EH handlers may increment skb->transport_header (both ipv6_destopt_rcv and ipv6_rthdr_rcv do so). So if we'd like to read the nexthdr at the EH handlers we should repeat the "skb pull; read nexthdr from skb_network_header(skb)[new nhoff]; return nexhdr;" prior each positive return from EH handlers. Thanks Shmulik