public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
@ 2017-06-09 19:06 Chenbo Feng
  2017-06-09 19:08 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Chenbo Feng @ 2017-06-09 19:06 UTC (permalink / raw)
  To: netdev, David Miller; +Cc: Lorenzo Colitti, Eric Dumazet, Chenbo Feng

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>
---
 net/ipv6/ip6_output.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 19:06 [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output Chenbo Feng
@ 2017-06-09 19:08 ` David Miller
  2017-06-09 19:13   ` Chenbo Feng
       [not found] ` <CAMOXUJnJ+e=f3x7gZsh4f=Fn01pspDqMKJFqc7cb7umV8SXtaw@mail.gmail.com>
  2017-06-09 21:11 ` Eric Dumazet
  2 siblings, 1 reply; 11+ messages in thread
From: David Miller @ 2017-06-09 19:08 UTC (permalink / raw)
  To: chenbofeng.kernel; +Cc: netdev, lorenzo, edumazet, fengc

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 19:08 ` David Miller
@ 2017-06-09 19:13   ` Chenbo Feng
  2017-06-09 19:24     ` Bjørn Mork
  2017-06-09 19:39     ` David Miller
  0 siblings, 2 replies; 11+ messages in thread
From: Chenbo Feng @ 2017-06-09 19:13 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, lorenzo, edumazet, fengc



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 19:13   ` Chenbo Feng
@ 2017-06-09 19:24     ` Bjørn Mork
  2017-06-09 19:45       ` Chenbo Feng
  2017-06-10 14:56       ` Eric Dumazet
  2017-06-09 19:39     ` David Miller
  1 sibling, 2 replies; 11+ messages in thread
From: Bjørn Mork @ 2017-06-09 19:24 UTC (permalink / raw)
  To: Chenbo Feng; +Cc: David Miller, netdev, lorenzo, edumazet, fengc

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
       [not found] ` <CAMOXUJnJ+e=f3x7gZsh4f=Fn01pspDqMKJFqc7cb7umV8SXtaw@mail.gmail.com>
@ 2017-06-09 19:39   ` David Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2017-06-09 19:39 UTC (permalink / raw)
  To: fengc; +Cc: chenbofeng.kernel, netdev, lorenzo, edumazet

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 19:13   ` Chenbo Feng
  2017-06-09 19:24     ` Bjørn Mork
@ 2017-06-09 19:39     ` David Miller
  2017-06-09 23:12       ` Chenbo Feng
  1 sibling, 1 reply; 11+ messages in thread
From: David Miller @ 2017-06-09 19:39 UTC (permalink / raw)
  To: chenbofeng.kernel; +Cc: netdev, lorenzo, edumazet, fengc

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 19:24     ` Bjørn Mork
@ 2017-06-09 19:45       ` Chenbo Feng
  2017-06-10 14:56       ` Eric Dumazet
  1 sibling, 0 replies; 11+ messages in thread
From: Chenbo Feng @ 2017-06-09 19:45 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: David Miller, netdev, lorenzo, edumazet, fengc



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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 19:06 [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output Chenbo Feng
  2017-06-09 19:08 ` David Miller
       [not found] ` <CAMOXUJnJ+e=f3x7gZsh4f=Fn01pspDqMKJFqc7cb7umV8SXtaw@mail.gmail.com>
@ 2017-06-09 21:11 ` Eric Dumazet
  2 siblings, 0 replies; 11+ messages in thread
From: Eric Dumazet @ 2017-06-09 21:11 UTC (permalink / raw)
  To: Chenbo Feng; +Cc: netdev, David Miller, Lorenzo Colitti, Chenbo Feng

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 :/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 19:39     ` David Miller
@ 2017-06-09 23:12       ` Chenbo Feng
  2017-06-10 14:54         ` Eric Dumazet
  0 siblings, 1 reply; 11+ messages in thread
From: Chenbo Feng @ 2017-06-09 23:12 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, lorenzo, edumazet, fengc



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 23:12       ` Chenbo Feng
@ 2017-06-10 14:54         ` Eric Dumazet
  0 siblings, 0 replies; 11+ messages in thread
From: Eric Dumazet @ 2017-06-10 14:54 UTC (permalink / raw)
  To: Chenbo Feng; +Cc: David Miller, netdev, lorenzo, edumazet, fengc

On Fri, 2017-06-09 at 16:12 -0700, Chenbo Feng wrote:
> 
> 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

No worries !

It seems the revert is not needed, after further analysis.

One of the point I raised was this no longer needed chunk, that can be
added as a separate patch :

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 02cd44f0953900108701895108b2fdaa9f9980e5..0d6f3b6345de26c329ae1d6f25dde652a5452d4b 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -869,7 +869,6 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
 	if (skb->sk && dst_allfrag(skb_dst(skb)))
 		sk_nocaps_add(skb->sk, NETIF_F_GSO_MASK);
 
-	skb->dev = skb_dst(skb)->dev;
 	icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
 	err = -EMSGSIZE;
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output
  2017-06-09 19:24     ` Bjørn Mork
  2017-06-09 19:45       ` Chenbo Feng
@ 2017-06-10 14:56       ` Eric Dumazet
  1 sibling, 0 replies; 11+ messages in thread
From: Eric Dumazet @ 2017-06-10 14:56 UTC (permalink / raw)
  To: Bjørn Mork
  Cc: Chenbo Feng, David Miller, netdev, lorenzo, edumazet, fengc

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-06-10 14:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-09 19:06 [PATCH net-next] ipv6: Initial skb->dev and skb->protocol in ip6_output Chenbo Feng
2017-06-09 19:08 ` David Miller
2017-06-09 19:13   ` Chenbo Feng
2017-06-09 19:24     ` Bjørn Mork
2017-06-09 19:45       ` Chenbo Feng
2017-06-10 14:56       ` Eric Dumazet
2017-06-09 19:39     ` David Miller
2017-06-09 23:12       ` Chenbo Feng
2017-06-10 14:54         ` Eric Dumazet
     [not found] ` <CAMOXUJnJ+e=f3x7gZsh4f=Fn01pspDqMKJFqc7cb7umV8SXtaw@mail.gmail.com>
2017-06-09 19:39   ` David Miller
2017-06-09 21:11 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox