netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: 8021q: skip packets if the vlan is down
@ 2017-10-03 20:13 Vishakha Narvekar
  2017-10-05  1:23 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Vishakha Narvekar @ 2017-10-03 20:13 UTC (permalink / raw)
  To: netdev; +Cc: allen.hubbe, andrew.boyer, Vishakha Narvekar, David S. Miller

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>
---
I don't know if this is the appropriate change, or if it is supposed to
work as before.  This change seemed to fix the behavior for bonding.

 net/8021q/vlan_core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index e2ed698..0bc31de 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -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.
-- 
1.8.3.1

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

* Re: [PATCH] net: 8021q: skip packets if the vlan is down
  2017-10-03 20:13 [PATCH] net: 8021q: skip packets if the vlan is down Vishakha Narvekar
@ 2017-10-05  1:23 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-10-05  1:23 UTC (permalink / raw)
  To: Vishakha.Narvekar; +Cc: netdev, allen.hubbe, andrew.boyer

From: Vishakha Narvekar <Vishakha.Narvekar@dell.com>
Date: Tue,  3 Oct 2017 16:13:29 -0400

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

I've applied this for now.

This is likely the best we can do in the software case.

In the hardware offload case, we really should (via the notifier for
the vlan device going down), tell the hardware to stop receiving vlan
packets.

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

end of thread, other threads:[~2017-10-05  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-03 20:13 [PATCH] net: 8021q: skip packets if the vlan is down Vishakha Narvekar
2017-10-05  1:23 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).