Message ID | 1497035168-9093-1-git-send-email-chenbofeng.kernel@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Chenbo Feng <chenbofeng.kernel@gmail.com> Date: Fri, 9 Jun 2017 12:06:07 -0700 > From: Chenbo Feng <fengc@google.com> > > Move the initialization of skb->dev and skb->protocol from > ip6_finish_output2 to ip6_output. This can make the skb->dev and > skb->protocol information avalaible to the CGROUP eBPF filter. > > Signed-off-by: Chenbo Feng <fengc@google.com> > Acked-by: Eric Dumazet <edumazet@google.com> Applied, thanks. This makes ipv6 consistent with ipv4. I am surprised this wasn't noticed, for example, in netfilter.
On 06/09/2017 12:08 PM, David Miller wrote: > From: Chenbo Feng <chenbofeng.kernel@gmail.com> > Date: Fri, 9 Jun 2017 12:06:07 -0700 > >> From: Chenbo Feng <fengc@google.com> >> >> Move the initialization of skb->dev and skb->protocol from >> ip6_finish_output2 to ip6_output. This can make the skb->dev and >> skb->protocol information avalaible to the CGROUP eBPF filter. >> >> Signed-off-by: Chenbo Feng <fengc@google.com> >> Acked-by: Eric Dumazet <edumazet@google.com> > Applied, thanks. > > This makes ipv6 consistent with ipv4. > > I am surprised this wasn't noticed, for example, in netfilter. > . > Hi David, This patch is still under working since it may have problem with ip_fragment() call, did you applied it already? Should I send a revert patch to you then? Chenbo Feng
Chenbo Feng <chenbofeng.kernel@gmail.com> writes: > This patch is still under working since it may have problem with > ip_fragment() call, did you applied it already? Should I send a revert > patch to you then? It does? I initially thought so too, but looking closer I believe the ip6_copy_metadata() calls in ip6_fragment() takes care of it. Bjørn
From: Chenbo Feng <fengc@google.com> Date: Fri, 9 Jun 2017 12:08:39 -0700 > Sorry, this is the wrong patch, please ignore it. :-/ already applied it. You must now send a relative fixup patch.
From: Chenbo Feng <chenbofeng.kernel@gmail.com> Date: Fri, 9 Jun 2017 12:13:57 -0700 > > > On 06/09/2017 12:08 PM, David Miller wrote: >> From: Chenbo Feng <chenbofeng.kernel@gmail.com> >> Date: Fri, 9 Jun 2017 12:06:07 -0700 >> >>> From: Chenbo Feng <fengc@google.com> >>> >>> Move the initialization of skb->dev and skb->protocol from >>> ip6_finish_output2 to ip6_output. This can make the skb->dev and >>> skb->protocol information avalaible to the CGROUP eBPF filter. >>> >>> Signed-off-by: Chenbo Feng <fengc@google.com> >>> Acked-by: Eric Dumazet <edumazet@google.com> >> Applied, thanks. >> >> This makes ipv6 consistent with ipv4. >> >> I am surprised this wasn't noticed, for example, in netfilter. >> . >> > Hi David, > > This patch is still under working since it may have problem with > ip_fragment() call, did you applied it already? Should I send a revert > patch to you then? A revert is necessary or a relative fixup. Thank you.
On 06/09/2017 12:24 PM, Bjørn Mork wrote: > Chenbo Feng <chenbofeng.kernel@gmail.com> writes: > >> This patch is still under working since it may have problem with >> ip_fragment() call, did you applied it already? Should I send a revert >> patch to you then? > It does? I initially thought so too, but looking closer I believe the > ip6_copy_metadata() calls in ip6_fragment() takes care of it. > > > > Bjørn > At least in the fail_toobig code path of ip_fragment() call, skb->dev get assigned again. It seems to be redundant with this patch or it will rewrite the skb->dev field. I will revert this one and upload again after I have a proper handle for that.
On Fri, Jun 9, 2017 at 12:06 PM, Chenbo Feng <chenbofeng.kernel@gmail.com> wrote: > From: Chenbo Feng <fengc@google.com> > > Move the initialization of skb->dev and skb->protocol from > ip6_finish_output2 to ip6_output. This can make the skb->dev and > skb->protocol information avalaible to the CGROUP eBPF filter. > > Signed-off-by: Chenbo Feng <fengc@google.com> > Acked-by: Eric Dumazet <edumazet@google.com> > --- Arg, you mixed my Acked-by for your other patch :/
On 06/09/2017 12:39 PM, David Miller wrote: > From: Chenbo Feng <chenbofeng.kernel@gmail.com> > Date: Fri, 9 Jun 2017 12:13:57 -0700 > >> >> On 06/09/2017 12:08 PM, David Miller wrote: >>> From: Chenbo Feng <chenbofeng.kernel@gmail.com> >>> Date: Fri, 9 Jun 2017 12:06:07 -0700 >>> >>>> From: Chenbo Feng <fengc@google.com> >>>> >>>> Move the initialization of skb->dev and skb->protocol from >>>> ip6_finish_output2 to ip6_output. This can make the skb->dev and >>>> skb->protocol information avalaible to the CGROUP eBPF filter. >>>> >>>> Signed-off-by: Chenbo Feng <fengc@google.com> >>>> Acked-by: Eric Dumazet <edumazet@google.com> >>> Applied, thanks. >>> >>> This makes ipv6 consistent with ipv4. >>> >>> I am surprised this wasn't noticed, for example, in netfilter. >>> . >>> >> Hi David, >> >> This patch is still under working since it may have problem with >> ip_fragment() call, did you applied it already? Should I send a revert >> patch to you then? > A revert is necessary or a relative fixup. > > Thank you. > Hi David, The revert is uploaded here: http://patchwork.ozlabs.org/patch/774136/ Thanks and sorry for the trouble caused Chenbo Feng
On Fri, 2017-06-09 at 21:24 +0200, Bjørn Mork wrote: > Chenbo Feng <chenbofeng.kernel@gmail.com> writes: > > > This patch is still under working since it may have problem with > > ip_fragment() call, did you applied it already? Should I send a revert > > patch to you then? > > It does? I initially thought so too, but looking closer I believe the > ip6_copy_metadata() calls in ip6_fragment() takes care of it. Indeed, this should be fine.
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index bf8a58a..02cd44f 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -67,9 +67,6 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * struct in6_addr *nexthop; int ret; - skb->protocol = htons(ETH_P_IPV6); - skb->dev = dev; - if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) { struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); @@ -154,6 +151,9 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb) struct net_device *dev = skb_dst(skb)->dev; struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); + skb->protocol = htons(ETH_P_IPV6); + skb->dev = dev; + if (unlikely(idev->cnf.disable_ipv6)) { IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); kfree_skb(skb);