Skip to content

Commit

Permalink
openvswitch: Drop packets when interdev is not up
Browse files Browse the repository at this point in the history
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 <lichunhe@huawei.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
  • Loading branch information
Chunhe Li authored and Pravin B Shelar committed Nov 6, 2014
1 parent cc3a5ae commit e1f9c35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/openvswitch/vport-internal_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,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;
}

len = skb->len;

skb_dst_drop(skb);
Expand Down

0 comments on commit e1f9c35

Please sign in to comment.