diff options
| -rw-r--r-- | include/linux/if_vlan.h | 5 | ||||
| -rw-r--r-- | include/linux/netdevice.h | 24 | ||||
| -rw-r--r-- | net/core/dev.c | 18 |
3 files changed, 30 insertions, 17 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 383627ad328f..ab2740832742 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
| @@ -155,6 +155,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, | |||
| 155 | { | 155 | { |
| 156 | struct net_device_stats *stats; | 156 | struct net_device_stats *stats; |
| 157 | 157 | ||
| 158 | if (skb_bond_should_drop(skb)) { | ||
| 159 | dev_kfree_skb_any(skb); | ||
| 160 | return NET_RX_DROP; | ||
| 161 | } | ||
| 162 | |||
| 158 | skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; | 163 | skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; |
| 159 | if (skb->dev == NULL) { | 164 | if (skb->dev == NULL) { |
| 160 | dev_kfree_skb_any(skb); | 165 | dev_kfree_skb_any(skb); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 75f02d8c6ed3..c0c2b46face1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -1012,6 +1012,30 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | |||
| 1012 | unlikely(skb->ip_summed != CHECKSUM_HW)); | 1012 | unlikely(skb->ip_summed != CHECKSUM_HW)); |
| 1013 | } | 1013 | } |
| 1014 | 1014 | ||
| 1015 | /* On bonding slaves other than the currently active slave, suppress | ||
| 1016 | * duplicates except for 802.3ad ETH_P_SLOW and alb non-mcast/bcast. | ||
| 1017 | */ | ||
| 1018 | static inline int skb_bond_should_drop(struct sk_buff *skb) | ||
| 1019 | { | ||
| 1020 | struct net_device *dev = skb->dev; | ||
| 1021 | struct net_device *master = dev->master; | ||
| 1022 | |||
| 1023 | if (master && | ||
| 1024 | (dev->priv_flags & IFF_SLAVE_INACTIVE)) { | ||
| 1025 | if (master->priv_flags & IFF_MASTER_ALB) { | ||
| 1026 | if (skb->pkt_type != PACKET_BROADCAST && | ||
| 1027 | skb->pkt_type != PACKET_MULTICAST) | ||
| 1028 | return 0; | ||
| 1029 | } | ||
| 1030 | if (master->priv_flags & IFF_MASTER_8023AD && | ||
| 1031 | skb->protocol == __constant_htons(ETH_P_SLOW)) | ||
| 1032 | return 0; | ||
| 1033 | |||
| 1034 | return 1; | ||
| 1035 | } | ||
| 1036 | return 0; | ||
| 1037 | } | ||
| 1038 | |||
| 1015 | #endif /* __KERNEL__ */ | 1039 | #endif /* __KERNEL__ */ |
| 1016 | 1040 | ||
| 1017 | #endif /* _LINUX_DEV_H */ | 1041 | #endif /* _LINUX_DEV_H */ |
diff --git a/net/core/dev.c b/net/core/dev.c index d95e2626d944..9fe96cde3e19 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -1619,26 +1619,10 @@ static inline struct net_device *skb_bond(struct sk_buff *skb) | |||
| 1619 | struct net_device *dev = skb->dev; | 1619 | struct net_device *dev = skb->dev; |
| 1620 | 1620 | ||
| 1621 | if (dev->master) { | 1621 | if (dev->master) { |
| 1622 | /* | 1622 | if (skb_bond_should_drop(skb)) { |
| 1623 | * On bonding slaves other than the currently active | ||
| 1624 | * slave, suppress duplicates except for 802.3ad | ||
| 1625 | * ETH_P_SLOW and alb non-mcast/bcast. | ||
| 1626 | */ | ||
| 1627 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | ||
| 1628 | if (dev->master->priv_flags & IFF_MASTER_ALB) { | ||
| 1629 | if (skb->pkt_type != PACKET_BROADCAST && | ||
| 1630 | skb->pkt_type != PACKET_MULTICAST) | ||
| 1631 | goto keep; | ||
| 1632 | } | ||
| 1633 | |||
| 1634 | if (dev->master->priv_flags & IFF_MASTER_8023AD && | ||
| 1635 | skb->protocol == __constant_htons(ETH_P_SLOW)) | ||
| 1636 | goto keep; | ||
| 1637 | |||
| 1638 | kfree_skb(skb); | 1623 | kfree_skb(skb); |
| 1639 | return NULL; | 1624 | return NULL; |
| 1640 | } | 1625 | } |
| 1641 | keep: | ||
| 1642 | skb->dev = dev->master; | 1626 | skb->dev = dev->master; |
| 1643 | } | 1627 | } |
| 1644 | 1628 | ||
