From: Chunhe Li <[email protected]>

If the internal device is not up, it should drop received packets. Sometimes
it receive the broadcast or multicast packets, and the ip protocol stack will
casue more cpu usage wasted.

Signed-off-by: Chunhe Li <[email protected]>
---
 datapath/vport-internal_dev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index 3b0f9a7..b0e1b24 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -242,6 +242,11 @@ static int internal_dev_recv(struct vport *vport, struct 
sk_buff *skb)
        struct net_device *netdev = netdev_vport_priv(vport)->dev;
        int len;
 
+       if (netdev && !(netdev->flags & IFF_UP)) {
+               kfree_skb(skb);
+               return 0;
+       }
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
        if (vlan_tx_tag_present(skb)) {
                if (unlikely(!__vlan_put_tag(skb,
-- 
1.9.2.0


_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to