Commit e408336a authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller
Browse files

bridge: Pass VLAN ID to br_flood()



Subsequent patches are going to add per-{Port, VLAN} neighbor
suppression, which will require br_flood() to potentially suppress ARP /
NS packets on a per-{Port, VLAN} basis.

As a preparation, pass the VLAN ID of the packet as another argument to
br_flood().

Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 013a7ce8
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -80,10 +80,10 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)

	dest = eth_hdr(skb)->h_dest;
	if (is_broadcast_ether_addr(dest)) {
		br_flood(br, skb, BR_PKT_BROADCAST, false, true);
		br_flood(br, skb, BR_PKT_BROADCAST, false, true, vid);
	} else if (is_multicast_ether_addr(dest)) {
		if (unlikely(netpoll_tx_running(dev))) {
			br_flood(br, skb, BR_PKT_MULTICAST, false, true);
			br_flood(br, skb, BR_PKT_MULTICAST, false, true, vid);
			goto out;
		}
		if (br_multicast_rcv(&brmctx, &pmctx_null, vlan, skb, vid)) {
@@ -96,11 +96,11 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
		    br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst))
			br_multicast_flood(mdst, skb, brmctx, false, true);
		else
			br_flood(br, skb, BR_PKT_MULTICAST, false, true);
			br_flood(br, skb, BR_PKT_MULTICAST, false, true, vid);
	} else if ((dst = br_fdb_find_rcu(br, dest, vid)) != NULL) {
		br_forward(dst->dst, skb, false, true);
	} else {
		br_flood(br, skb, BR_PKT_UNICAST, false, true);
		br_flood(br, skb, BR_PKT_UNICAST, false, true, vid);
	}
out:
	rcu_read_unlock();
+2 −1
Original line number Diff line number Diff line
@@ -197,7 +197,8 @@ static struct net_bridge_port *maybe_deliver(

/* called under rcu_read_lock */
void br_flood(struct net_bridge *br, struct sk_buff *skb,
	      enum br_pkt_type pkt_type, bool local_rcv, bool local_orig)
	      enum br_pkt_type pkt_type, bool local_rcv, bool local_orig,
	      u16 vid)
{
	struct net_bridge_port *prev = NULL;
	struct net_bridge_port *p;
+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
		br_forward(dst->dst, skb, local_rcv, false);
	} else {
		if (!mcast_hit)
			br_flood(br, skb, pkt_type, local_rcv, false);
			br_flood(br, skb, pkt_type, local_rcv, false, vid);
		else
			br_multicast_flood(mdst, skb, brmctx, local_rcv, false);
	}
+2 −1
Original line number Diff line number Diff line
@@ -849,7 +849,8 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb,
		bool local_rcv, bool local_orig);
int br_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb);
void br_flood(struct net_bridge *br, struct sk_buff *skb,
	      enum br_pkt_type pkt_type, bool local_rcv, bool local_orig);
	      enum br_pkt_type pkt_type, bool local_rcv, bool local_orig,
	      u16 vid);

/* return true if both source port and dest port are isolated */
static inline bool br_skb_isolated(const struct net_bridge_port *to,