Ethernet Bridge development
 help / color / mirror / Atom feed
* [Bridge] [PATCH net-next v1 1/1] net: bridge: ensure that link-local traffic cannot unlock a locked port
@ 2022-06-30 11:16 Hans Schultz
  2022-06-30 11:17 ` Nikolay Aleksandrov
  2022-06-30 11:37 ` Ido Schimmel
  0 siblings, 2 replies; 25+ messages in thread
From: Hans Schultz @ 2022-06-30 11:16 UTC (permalink / raw)
  To: davem, kuba
  Cc: Ivan Vecera, Andrew Lunn, Florian Fainelli, Jiri Pirko,
	Daniel Borkmann, Hans Schultz, netdev, Nikolay Aleksandrov,
	bridge, Hans Schultz, Ido Schimmel, linux-kernel, Eric Dumazet,
	linux-kselftest, Roopa Prabhu, Paolo Abeni, Vladimir Oltean,
	Shuah Khan, Vivien Didelot

This patch is related to the patch set
"Add support for locked bridge ports (for 802.1X)"
Link: https://lore.kernel.org/netdev/20220223101650.1212814-1-schultz.hans+netdev@gmail.com/

This patch makes the locked port feature work with learning turned on,
which is enabled with the command:

bridge link set dev DEV learning on

Without this patch, link local traffic (01:80:c2) like EAPOL packets will
create a fdb entry when ingressing on a locked port with learning turned
on, thus unintentionally opening up the port for traffic for the said MAC.

Some switchcore features like Mac-Auth and refreshing of FDB entries,
require learning enables on some switchcores, f.ex. the mv88e6xxx family.
Other features may apply too.

Since many switchcores trap or mirror various multicast packets to the
CPU, link local traffic will unintentionally unlock the port for the
SA mac in question unless prevented by this patch.

Signed-off-by: Hans Schultz <hans@kapio-technology.com>
---
 net/bridge/br_input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 68b3e850bcb9..a3ce0a151817 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -215,6 +215,7 @@ static void __br_handle_local_finish(struct sk_buff *skb)
 	if ((p->flags & BR_LEARNING) &&
 	    nbp_state_should_learn(p) &&
 	    !br_opt_get(p->br, BROPT_NO_LL_LEARN) &&
+	    !(p->flags & BR_PORT_LOCKED) &&
 	    br_should_learn(p, skb, &vid))
 		br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, 0);
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2022-07-29  5:23 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-30 11:16 [Bridge] [PATCH net-next v1 1/1] net: bridge: ensure that link-local traffic cannot unlock a locked port Hans Schultz
2022-06-30 11:17 ` Nikolay Aleksandrov
2022-06-30 11:37 ` Ido Schimmel
2022-06-30 12:54   ` Hans Schultz
2022-07-01  7:47   ` Hans S
2022-07-01 13:51     ` Ido Schimmel
2022-07-01 15:27       ` Vladimir Oltean
2022-07-01 15:44         ` Ido Schimmel
2022-07-01 16:07       ` Hans S
2022-07-01 17:00         ` Ido Schimmel
2022-07-01 19:17           ` Hans S
2022-07-03  7:00             ` Ido Schimmel
2022-07-04  7:54               ` Hans S
2022-07-04 10:59                 ` Ido Schimmel
2022-07-04 14:36                   ` Hans S
2022-07-05 10:53                     ` Ido Schimmel
2022-07-17 13:46         ` Vladimir Oltean
2022-07-17 14:03           ` Vladimir Oltean
2022-07-17 16:22             ` Hans S
2022-07-17 18:38               ` Vladimir Oltean
2022-07-17 19:20                 ` Hans S
2022-07-21 11:45                   ` Vladimir Oltean
2022-07-21 14:06                     ` Hans S
2022-07-24  8:09                     ` Hans S
2022-07-29  5:23                       ` Hans S

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox