aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorFlorian Zumbiehl <florz@florz.de>2012-10-07 11:51:58 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-08 15:21:55 -0400
commit48cc32d38a52d0b68f91a171a8d00531edc6a46e (patch)
tree780c4919aeda44d0c6859b840a29847aeb792d1a /net/core
parent2e71a6f8084e7ac87166dd77d99c44190fb844fc (diff)
vlan: don't deliver frames for unknown vlans to protocols
6a32e4f9dd9219261f8856f817e6655114cfec2f made the vlan code skip marking vlan-tagged frames for not locally configured vlans as PACKET_OTHERHOST if there was an rx_handler, as the rx_handler could cause the frame to be received on a different (virtual) vlan-capable interface where that vlan might be configured. As rx_handlers do not necessarily return RX_HANDLER_ANOTHER, this could cause frames for unknown vlans to be delivered to the protocol stack as if they had been received untagged. For example, if an ipv6 router advertisement that's tagged for a locally not configured vlan is received on an interface with macvlan interfaces attached, macvlan's rx_handler returns RX_HANDLER_PASS after delivering the frame to the macvlan interfaces, which caused it to be passed to the protocol stack, leading to ipv6 addresses for the announced prefix being configured even though those are completely unusable on the underlying interface. The fix moves marking as PACKET_OTHERHOST after the rx_handler so the rx_handler, if there is one, sees the frame unchanged, but afterwards, before the frame is delivered to the protocol stack, it gets marked whether there is an rx_handler or not. Signed-off-by: Florian Zumbiehl <florz@florz.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index d44668f63c88..09cb3f6dc40c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3300,18 +3300,18 @@ ncls:
3300 && !skb_pfmemalloc_protocol(skb)) 3300 && !skb_pfmemalloc_protocol(skb))
3301 goto drop; 3301 goto drop;
3302 3302
3303 rx_handler = rcu_dereference(skb->dev->rx_handler);
3304 if (vlan_tx_tag_present(skb)) { 3303 if (vlan_tx_tag_present(skb)) {
3305 if (pt_prev) { 3304 if (pt_prev) {
3306 ret = deliver_skb(skb, pt_prev, orig_dev); 3305 ret = deliver_skb(skb, pt_prev, orig_dev);
3307 pt_prev = NULL; 3306 pt_prev = NULL;
3308 } 3307 }
3309 if (vlan_do_receive(&skb, !rx_handler)) 3308 if (vlan_do_receive(&skb))
3310 goto another_round; 3309 goto another_round;
3311 else if (unlikely(!skb)) 3310 else if (unlikely(!skb))
3312 goto unlock; 3311 goto unlock;
3313 } 3312 }
3314 3313
3314 rx_handler = rcu_dereference(skb->dev->rx_handler);
3315 if (rx_handler) { 3315 if (rx_handler) {
3316 if (pt_prev) { 3316 if (pt_prev) {
3317 ret = deliver_skb(skb, pt_prev, orig_dev); 3317 ret = deliver_skb(skb, pt_prev, orig_dev);
@@ -3331,6 +3331,9 @@ ncls:
3331 } 3331 }
3332 } 3332 }
3333 3333
3334 if (vlan_tx_nonzero_tag_present(skb))
3335 skb->pkt_type = PACKET_OTHERHOST;
3336
3334 /* deliver only exact match when indicated */ 3337 /* deliver only exact match when indicated */
3335 null_or_dev = deliver_exact ? skb->dev : NULL; 3338 null_or_dev = deliver_exact ? skb->dev : NULL;
3336 3339