core/dev: do not ignore dmac in dev_forward_skb()
Subsystems (2)
PATCH 1/1 core/dev: do not ignore dmac in dev_forward_skb()
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
---
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(-)
net/core/dev.c +1 -5
@@ -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); }
Signature · 1 line
1.7.9.5
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.
Quoted 5 lines · Maciej Żenczykowski
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.
Quoted 9 lines · Alexei Starovoitov
Quoted 5 lines · Maciej Żenczykowski
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,
Signature · 1 line
Isaku Yamahata <[email protected]>
Quoted 10 lines · Alexei Starovoitov
commit
06a23fe31ca3
("core/dev: setpkt_typeaftereth_type_trans()indev_forward_skb()") and refactoring64261f230a91
("dev: moveskb_scrub_packet()aftereth_type_trans()")are forcing
pkt_typeto bePACKET_HOSTwhen skb traverses veth.which means that ip forwarding will kick in inside netns even if
skb->eth->h_dest!=dev->dev_addr
Quoted 6 lines
Revert offending commit
Fixes 06a23fe31ca3 ("core/dev: set pkt_type after eth_type_trans() in dev_forward_skb()")CC Maciej Zenczykowski <[email protected]>CC Nicolas Dichtel <[email protected]>Signed-off-by Alexei Starovoitov <[email protected]>
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.