Skip to content

Commit 60d6be0

Browse files
pmachatakuba-moo
authored andcommitted
net: bridge: BROPT_FDB_LOCAL_VLAN_0: Look up FDB on VLAN 0 on miss
When BROPT_FDB_LOCAL_VLAN_0 is enabled, the local FDB entries for the member ports as well as the bridge itself should not be created per-VLAN, but instead only on VLAN 0. That means that br_handle_frame_finish() needs to make two lookups: the primary lookup on an appropriate VLAN, and when that misses, a lookup on VLAN 0. Have the second lookup only accept local MAC addresses. Turning this into a generic second-lookup feature is not the goal. Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Acked-by: Nikolay Aleksandrov <[email protected]> Link: https://patch.msgid.link/8087475009dce360fb68d873b1ed9c80827da302.1757004393.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c116417 commit 60d6be0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

net/bridge/br_input.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
202202
break;
203203
case BR_PKT_UNICAST:
204204
dst = br_fdb_find_rcu(br, eth_hdr(skb)->h_dest, vid);
205+
if (unlikely(!dst && vid &&
206+
br_opt_get(br, BROPT_FDB_LOCAL_VLAN_0))) {
207+
dst = br_fdb_find_rcu(br, eth_hdr(skb)->h_dest, 0);
208+
if (dst &&
209+
(!test_bit(BR_FDB_LOCAL, &dst->flags) ||
210+
test_bit(BR_FDB_ADDED_BY_USER, &dst->flags)))
211+
dst = NULL;
212+
}
205213
break;
206214
default:
207215
break;

0 commit comments

Comments
 (0)