net: 8021q: skip packets if the vlan is down
authorVishakha Narvekar <Vishakha.Narvekar@dell.com>
Tue, 3 Oct 2017 20:13:29 +0000 (16:13 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Oct 2017 01:16:48 +0000 (18:16 -0700)
If the vlan is down, free the packet instead of proceeding with other
processing, or counting it as received.  If vlan interfaces are used
as slaves for bonding, with arp monitoring for connectivity, if the rx
counter is seen to be incrementing, then the bond device will not
observe that the interface is down.

CC: David S. Miller <davem@davemloft.net>
Signed-off-by: Vishakha Narvekar <Vishakha.Narvekar@dell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/8021q/vlan_core.c

index e2ed69850489bb79a6a055ee3264456a31acee3e..0bc31de9071a2112dbbd622dbb5646a5fe86fd3c 100644 (file)
@@ -21,6 +21,12 @@ bool vlan_do_receive(struct sk_buff **skbp)
        if (unlikely(!skb))
                return false;
 
+       if (unlikely(!(vlan_dev->flags & IFF_UP))) {
+               kfree_skb(skb);
+               *skbp = NULL;
+               return false;
+       }
+
        skb->dev = vlan_dev;
        if (unlikely(skb->pkt_type == PACKET_OTHERHOST)) {
                /* Our lower layer thinks this is not local, let's make sure.