diff options
-rw-r--r-- | include/linux/netdevice.h | 48 | ||||
-rw-r--r-- | net/core/dev.c | 49 |
2 files changed, 53 insertions, 44 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d1a21b576a40..470f7c951afb 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2089,54 +2089,14 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
2089 | dev->gso_max_size = size; | 2089 | dev->gso_max_size = size; |
2090 | } | 2090 | } |
2091 | 2091 | ||
2092 | static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, | 2092 | extern int __skb_bond_should_drop(struct sk_buff *skb, |
2093 | struct net_device *master) | 2093 | struct net_device *master); |
2094 | { | ||
2095 | if (skb->pkt_type == PACKET_HOST) { | ||
2096 | u16 *dest = (u16 *) eth_hdr(skb)->h_dest; | ||
2097 | |||
2098 | memcpy(dest, master->dev_addr, ETH_ALEN); | ||
2099 | } | ||
2100 | } | ||
2101 | 2094 | ||
2102 | /* On bonding slaves other than the currently active slave, suppress | ||
2103 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and | ||
2104 | * ARP on active-backup slaves with arp_validate enabled. | ||
2105 | */ | ||
2106 | static inline int skb_bond_should_drop(struct sk_buff *skb, | 2095 | static inline int skb_bond_should_drop(struct sk_buff *skb, |
2107 | struct net_device *master) | 2096 | struct net_device *master) |
2108 | { | 2097 | { |
2109 | if (master) { | 2098 | if (master) |
2110 | struct net_device *dev = skb->dev; | 2099 | return __skb_bond_should_drop(skb, master); |
2111 | |||
2112 | if (master->priv_flags & IFF_MASTER_ARPMON) | ||
2113 | dev->last_rx = jiffies; | ||
2114 | |||
2115 | if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) { | ||
2116 | /* Do address unmangle. The local destination address | ||
2117 | * will be always the one master has. Provides the right | ||
2118 | * functionality in a bridge. | ||
2119 | */ | ||
2120 | skb_bond_set_mac_by_master(skb, master); | ||
2121 | } | ||
2122 | |||
2123 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | ||
2124 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | ||
2125 | skb->protocol == __cpu_to_be16(ETH_P_ARP)) | ||
2126 | return 0; | ||
2127 | |||
2128 | if (master->priv_flags & IFF_MASTER_ALB) { | ||
2129 | if (skb->pkt_type != PACKET_BROADCAST && | ||
2130 | skb->pkt_type != PACKET_MULTICAST) | ||
2131 | return 0; | ||
2132 | } | ||
2133 | if (master->priv_flags & IFF_MASTER_8023AD && | ||
2134 | skb->protocol == __cpu_to_be16(ETH_P_SLOW)) | ||
2135 | return 0; | ||
2136 | |||
2137 | return 1; | ||
2138 | } | ||
2139 | } | ||
2140 | return 0; | 2100 | return 0; |
2141 | } | 2101 | } |
2142 | 2102 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index ca4cdef74a1b..876b1112d5ba 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2646,6 +2646,55 @@ void netif_nit_deliver(struct sk_buff *skb) | |||
2646 | rcu_read_unlock(); | 2646 | rcu_read_unlock(); |
2647 | } | 2647 | } |
2648 | 2648 | ||
2649 | static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, | ||
2650 | struct net_device *master) | ||
2651 | { | ||
2652 | if (skb->pkt_type == PACKET_HOST) { | ||
2653 | u16 *dest = (u16 *) eth_hdr(skb)->h_dest; | ||
2654 | |||
2655 | memcpy(dest, master->dev_addr, ETH_ALEN); | ||
2656 | } | ||
2657 | } | ||
2658 | |||
2659 | /* On bonding slaves other than the currently active slave, suppress | ||
2660 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and | ||
2661 | * ARP on active-backup slaves with arp_validate enabled. | ||
2662 | */ | ||
2663 | int __skb_bond_should_drop(struct sk_buff *skb, struct net_device *master) | ||
2664 | { | ||
2665 | struct net_device *dev = skb->dev; | ||
2666 | |||
2667 | if (master->priv_flags & IFF_MASTER_ARPMON) | ||
2668 | dev->last_rx = jiffies; | ||
2669 | |||
2670 | if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) { | ||
2671 | /* Do address unmangle. The local destination address | ||
2672 | * will be always the one master has. Provides the right | ||
2673 | * functionality in a bridge. | ||
2674 | */ | ||
2675 | skb_bond_set_mac_by_master(skb, master); | ||
2676 | } | ||
2677 | |||
2678 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | ||
2679 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | ||
2680 | skb->protocol == __cpu_to_be16(ETH_P_ARP)) | ||
2681 | return 0; | ||
2682 | |||
2683 | if (master->priv_flags & IFF_MASTER_ALB) { | ||
2684 | if (skb->pkt_type != PACKET_BROADCAST && | ||
2685 | skb->pkt_type != PACKET_MULTICAST) | ||
2686 | return 0; | ||
2687 | } | ||
2688 | if (master->priv_flags & IFF_MASTER_8023AD && | ||
2689 | skb->protocol == __cpu_to_be16(ETH_P_SLOW)) | ||
2690 | return 0; | ||
2691 | |||
2692 | return 1; | ||
2693 | } | ||
2694 | return 0; | ||
2695 | } | ||
2696 | EXPORT_SYMBOL(__skb_bond_should_drop); | ||
2697 | |||
2649 | static int __netif_receive_skb(struct sk_buff *skb) | 2698 | static int __netif_receive_skb(struct sk_buff *skb) |
2650 | { | 2699 | { |
2651 | struct packet_type *ptype, *pt_prev; | 2700 | struct packet_type *ptype, *pt_prev; |