netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bridge: mdb: Allow replace of a host-joined group
@ 2025-02-04 17:37 Petr Machata
  2025-02-04 18:08 ` Nikolay Aleksandrov
  2025-02-06  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Machata @ 2025-02-04 17:37 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev
  Cc: Roopa Prabhu, Nikolay Aleksandrov, Ido Schimmel, Petr Machata,
	bridge, mlxsw

Attempts to replace an MDB group membership of the host itself are
currently bounced:

 # ip link add name br up type bridge vlan_filtering 1
 # bridge mdb replace dev br port br grp 239.0.0.1 vid 2
 # bridge mdb replace dev br port br grp 239.0.0.1 vid 2
 Error: bridge: Group is already joined by host.

A similar operation done on a member port would succeed. Ignore the check
for replacement of host group memberships as well.

The bit of code that this enables is br_multicast_host_join(), which, for
already-joined groups only refreshes the MC group expiration timer, which
is desirable; and a userspace notification, also desirable.

Change a selftest that exercises this code path from expecting a rejection
to expecting a pass. The rest of MDB selftests pass without modification.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
---
 net/bridge/br_mdb.c                                  | 2 +-
 tools/testing/selftests/net/forwarding/bridge_mdb.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 1a52a0bca086..7e1ad229e133 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -1040,7 +1040,7 @@ static int br_mdb_add_group(const struct br_mdb_config *cfg,
 
 	/* host join */
 	if (!port) {
-		if (mp->host_joined) {
+		if (mp->host_joined && !(cfg->nlflags & NLM_F_REPLACE)) {
 			NL_SET_ERR_MSG_MOD(extack, "Group is already joined by host");
 			return -EEXIST;
 		}
diff --git a/tools/testing/selftests/net/forwarding/bridge_mdb.sh b/tools/testing/selftests/net/forwarding/bridge_mdb.sh
index d9d587454d20..8c1597ebc2d3 100755
--- a/tools/testing/selftests/net/forwarding/bridge_mdb.sh
+++ b/tools/testing/selftests/net/forwarding/bridge_mdb.sh
@@ -149,7 +149,7 @@ cfg_test_host_common()
 	check_err $? "Failed to add $name host entry"
 
 	bridge mdb replace dev br0 port br0 grp $grp $state vid 10 &> /dev/null
-	check_fail $? "Managed to replace $name host entry"
+	check_err $? "Failed to replace $name host entry"
 
 	bridge mdb del dev br0 port br0 grp $grp $state vid 10
 	bridge mdb get dev br0 grp $grp vid 10 &> /dev/null
-- 
2.47.0


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

* Re: [PATCH net-next] bridge: mdb: Allow replace of a host-joined group
  2025-02-04 17:37 [PATCH net-next] bridge: mdb: Allow replace of a host-joined group Petr Machata
@ 2025-02-04 18:08 ` Nikolay Aleksandrov
  2025-02-06  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2025-02-04 18:08 UTC (permalink / raw)
  To: Petr Machata, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, netdev
  Cc: Roopa Prabhu, Ido Schimmel, bridge, mlxsw

On 2/4/25 19:37, Petr Machata wrote:
> Attempts to replace an MDB group membership of the host itself are
> currently bounced:
> 
>  # ip link add name br up type bridge vlan_filtering 1
>  # bridge mdb replace dev br port br grp 239.0.0.1 vid 2
>  # bridge mdb replace dev br port br grp 239.0.0.1 vid 2
>  Error: bridge: Group is already joined by host.
> 
> A similar operation done on a member port would succeed. Ignore the check
> for replacement of host group memberships as well.
> 
> The bit of code that this enables is br_multicast_host_join(), which, for
> already-joined groups only refreshes the MC group expiration timer, which
> is desirable; and a userspace notification, also desirable.
> 
> Change a selftest that exercises this code path from expecting a rejection
> to expecting a pass. The rest of MDB selftests pass without modification.
> 
> Signed-off-by: Petr Machata <petrm@nvidia.com>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> ---
>  net/bridge/br_mdb.c                                  | 2 +-
>  tools/testing/selftests/net/forwarding/bridge_mdb.sh | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 

Acked-by: Nikolay Aleksandrov <razor@blackwall.org>

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

* Re: [PATCH net-next] bridge: mdb: Allow replace of a host-joined group
  2025-02-04 17:37 [PATCH net-next] bridge: mdb: Allow replace of a host-joined group Petr Machata
  2025-02-04 18:08 ` Nikolay Aleksandrov
@ 2025-02-06  2:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-06  2:20 UTC (permalink / raw)
  To: Petr Machata
  Cc: davem, edumazet, kuba, pabeni, horms, netdev, roopa, razor,
	idosch, bridge, mlxsw

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 4 Feb 2025 18:37:15 +0100 you wrote:
> Attempts to replace an MDB group membership of the host itself are
> currently bounced:
> 
>  # ip link add name br up type bridge vlan_filtering 1
>  # bridge mdb replace dev br port br grp 239.0.0.1 vid 2
>  # bridge mdb replace dev br port br grp 239.0.0.1 vid 2
>  Error: bridge: Group is already joined by host.
> 
> [...]

Here is the summary with links:
  - [net-next] bridge: mdb: Allow replace of a host-joined group
    https://git.kernel.org/netdev/net-next/c/d9e9f6d7b7d0

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-02-06  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04 17:37 [PATCH net-next] bridge: mdb: Allow replace of a host-joined group Petr Machata
2025-02-04 18:08 ` Nikolay Aleksandrov
2025-02-06  2:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).