All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] core/dev: do not ignore dmac in dev_forward_skb()
@ 2013-11-11 21:52 Alexei Starovoitov
  2013-11-12  0:39 ` Maciej Żenczykowski
  2013-11-12  8:49 ` Nicolas Dichtel
  0 siblings, 2 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2013-11-11 21:52 UTC (permalink / raw)
  To: David S. Miller
  Cc: Eric Dumazet, netdev, Maciej Zenczykowski, Nicolas Dichtel

commit 06a23fe31ca3
("core/dev: set pkt_type after eth_type_trans() in dev_forward_skb()")
and refactoring 64261f230a91
("dev: move skb_scrub_packet() after eth_type_trans()")

are forcing pkt_type to be PACKET_HOST when skb traverses veth.

which means that ip forwarding will kick in inside netns
even if skb->eth->h_dest != dev->dev_addr

Revert offending commit

Fixes: 06a23fe31ca3 ("core/dev: set pkt_type after eth_type_trans() in dev_forward_skb()")
CC: Maciej Zenczykowski <zenczykowski@gmail.com>
CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
---

commit-06a23fe31ca3's testcase is still working,
since pkt_type is now set by ip tunnel

the diff is for 3.12
imo the bug is severe enough that worth queueing for 3.11

 net/core/dev.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 3430b1e..2afc521 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1691,13 +1691,9 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 		kfree_skb(skb);
 		return NET_RX_DROP;
 	}
-	skb->protocol = eth_type_trans(skb, dev);
 
-	/* eth_type_trans() can set pkt_type.
-	 * call skb_scrub_packet() after it to clear pkt_type _after_ calling
-	 * eth_type_trans().
-	 */
 	skb_scrub_packet(skb, true);
+	skb->protocol = eth_type_trans(skb, dev);
 
 	return netif_rx(skb);
 }
-- 
1.7.9.5

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

* Re: [PATCH net] core/dev: do not ignore dmac in dev_forward_skb()
  2013-11-11 21:52 [PATCH net] core/dev: do not ignore dmac in dev_forward_skb() Alexei Starovoitov
@ 2013-11-12  0:39 ` Maciej Żenczykowski
  2013-11-12  1:12   ` Alexei Starovoitov
  2013-11-12  8:49 ` Nicolas Dichtel
  1 sibling, 1 reply; 5+ messages in thread
From: Maciej Żenczykowski @ 2013-11-12  0:39 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: David S. Miller, Eric Dumazet, Linux NetDev, Nicolas Dichtel

Ack.

I'm sure this breaks whatever the original commit was trying to 'fix',
however it does so in a clearly incorrect manner by effectively
disabling dst mac address filtering.

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

* Re: [PATCH net] core/dev: do not ignore dmac in dev_forward_skb()
  2013-11-12  0:39 ` Maciej Żenczykowski
@ 2013-11-12  1:12   ` Alexei Starovoitov
  2013-11-12  5:25     ` Isaku Yamahata
  0 siblings, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2013-11-12  1:12 UTC (permalink / raw)
  To: Maciej Żenczykowski, isaku.yamahata
  Cc: David S. Miller, Eric Dumazet, Linux NetDev, Nicolas Dichtel

On Mon, Nov 11, 2013 at 4:39 PM, Maciej Żenczykowski
<zenczykowski@gmail.com> wrote:
> Ack.
>
> I'm sure this breaks whatever the original commit was trying to 'fix',
> however it does so in a clearly incorrect manner by effectively
> disabling dst mac address filtering.

actually it doesn't break it. Isaku's testcase works for me.

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

* Re: [PATCH net] core/dev: do not ignore dmac in dev_forward_skb()
  2013-11-12  1:12   ` Alexei Starovoitov
@ 2013-11-12  5:25     ` Isaku Yamahata
  0 siblings, 0 replies; 5+ messages in thread
From: Isaku Yamahata @ 2013-11-12  5:25 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Maciej Żenczykowski, isaku.yamahata, David S. Miller,
	Eric Dumazet, Linux NetDev, Nicolas Dichtel, yamahatanetdev

On Mon, Nov 11, 2013 at 05:12:10PM -0800,
Alexei Starovoitov <ast@plumgrid.com> wrote:

> On Mon, Nov 11, 2013 at 4:39 PM, Maciej Żenczykowski
> <zenczykowski@gmail.com> wrote:
> > Ack.
> >
> > I'm sure this breaks whatever the original commit was trying to 'fix',
> > however it does so in a clearly incorrect manner by effectively
> > disabling dst mac address filtering.
> 
> actually it doesn't break it. Isaku's testcase works for me.

The changeset of 963a88b31ddbbe99f38502239b1a46601773d217
  "tunnels: harmonize cleanup done on skb on xmit path"
addresses the issue by calling skb_scrub_packet() when sending skb
through tunnel. So it is safe to revert it.

thanks,
-- 
Isaku Yamahata <isaku.yamahata@gmail.com>

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

* Re: [PATCH net] core/dev: do not ignore dmac in dev_forward_skb()
  2013-11-11 21:52 [PATCH net] core/dev: do not ignore dmac in dev_forward_skb() Alexei Starovoitov
  2013-11-12  0:39 ` Maciej Żenczykowski
@ 2013-11-12  8:49 ` Nicolas Dichtel
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Dichtel @ 2013-11-12  8:49 UTC (permalink / raw)
  To: Alexei Starovoitov, David S. Miller
  Cc: Eric Dumazet, netdev, Maciej Zenczykowski

Le 11/11/2013 22:52, Alexei Starovoitov a écrit :
> commit 06a23fe31ca3
> ("core/dev: set pkt_type after eth_type_trans() in dev_forward_skb()")
> and refactoring 64261f230a91
> ("dev: move skb_scrub_packet() after eth_type_trans()")
>
> are forcing pkt_type to be PACKET_HOST when skb traverses veth.
>
> which means that ip forwarding will kick in inside netns
> even if skb->eth->h_dest != dev->dev_addr
>
> Revert offending commit
>
> Fixes: 06a23fe31ca3 ("core/dev: set pkt_type after eth_type_trans() in dev_forward_skb()")
> CC: Maciej Zenczykowski <zenczykowski@gmail.com>
> CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
skb_scrub_packet() is also called after eth_type_trans() in ip_tunnel_rcv().
I do it to be consistent with dev_forward_skb(), thus it should be inverted too.

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

end of thread, other threads:[~2013-11-12  8:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-11 21:52 [PATCH net] core/dev: do not ignore dmac in dev_forward_skb() Alexei Starovoitov
2013-11-12  0:39 ` Maciej Żenczykowski
2013-11-12  1:12   ` Alexei Starovoitov
2013-11-12  5:25     ` Isaku Yamahata
2013-11-12  8:49 ` Nicolas Dichtel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.