From: Chunhe Li Date: Wed, 30 Jul 2014 01:49:01 +0000 (+0800) Subject: datapath: Drop packets when interdev is not up X-Git-Tag: v2.3~8 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=edff57a8b0b3c33351e6bbd8746313eaee8cd20c datapath: Drop packets when interdev is not up 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 Acked-by: Pravin B Shelar --- diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c index 637d712d8..7432f1f76 100644 --- a/datapath/vport-internal_dev.c +++ b/datapath/vport-internal_dev.c @@ -236,6 +236,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 (unlikely(!(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,