diff mbox series

[net-next,01/14] bridge: mcast: Do not derive entry type from its filter mode

Message ID 20221208152839.1016350-2-idosch@nvidia.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series bridge: mcast: Extensions for EVPN | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ido Schimmel Dec. 8, 2022, 3:28 p.m. UTC
Currently, the filter mode (i.e., INCLUDE / EXCLUDE) of MDB entries
cannot be set from user space. Instead, it is set by the kernel
according to the entry type: (*, G) entries are treated as EXCLUDE and
(S, G) entries are treated as INCLUDE. This allows the kernel to derive
the entry type from its filter mode.

Subsequent patches will allow user space to set the filter mode of (*,
G) entries, making the current assumption incorrect.

As a preparation, remove the current assumption and instead determine
the entry type from its key, which is a more direct way.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 net/bridge/br_mdb.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Nikolay Aleksandrov Dec. 9, 2022, 7:27 a.m. UTC | #1
On 08/12/2022 17:28, Ido Schimmel wrote:
> Currently, the filter mode (i.e., INCLUDE / EXCLUDE) of MDB entries
> cannot be set from user space. Instead, it is set by the kernel
> according to the entry type: (*, G) entries are treated as EXCLUDE and
> (S, G) entries are treated as INCLUDE. This allows the kernel to derive
> the entry type from its filter mode.
> 
> Subsequent patches will allow user space to set the filter mode of (*,
> G) entries, making the current assumption incorrect.
> 
> As a preparation, remove the current assumption and instead determine
> the entry type from its key, which is a more direct way.
> 
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
>  net/bridge/br_mdb.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
> index ae7d93c08880..2b6921dbdc02 100644
> --- a/net/bridge/br_mdb.c
> +++ b/net/bridge/br_mdb.c
> @@ -857,17 +857,14 @@ static int br_mdb_add_group(const struct br_mdb_config *cfg,
>  	 * added to it for proper replication
>  	 */
>  	if (br_multicast_should_handle_mode(brmctx, group.proto)) {
> -		switch (filter_mode) {
> -		case MCAST_EXCLUDE:
> -			br_multicast_star_g_handle_mode(p, MCAST_EXCLUDE);
> -			break;
> -		case MCAST_INCLUDE:
> +		if (br_multicast_is_star_g(&group)) {
> +			br_multicast_star_g_handle_mode(p, filter_mode);
> +		} else {
>  			star_group = p->key.addr;
>  			memset(&star_group.src, 0, sizeof(star_group.src));
>  			star_mp = br_mdb_ip_get(br, &star_group);
>  			if (star_mp)
>  				br_multicast_sg_add_exclude_ports(star_mp, p);
> -			break;
>  		}
>  	}
>  

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

Patch

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index ae7d93c08880..2b6921dbdc02 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -857,17 +857,14 @@  static int br_mdb_add_group(const struct br_mdb_config *cfg,
 	 * added to it for proper replication
 	 */
 	if (br_multicast_should_handle_mode(brmctx, group.proto)) {
-		switch (filter_mode) {
-		case MCAST_EXCLUDE:
-			br_multicast_star_g_handle_mode(p, MCAST_EXCLUDE);
-			break;
-		case MCAST_INCLUDE:
+		if (br_multicast_is_star_g(&group)) {
+			br_multicast_star_g_handle_mode(p, filter_mode);
+		} else {
 			star_group = p->key.addr;
 			memset(&star_group.src, 0, sizeof(star_group.src));
 			star_mp = br_mdb_ip_get(br, &star_group);
 			if (star_mp)
 				br_multicast_sg_add_exclude_ports(star_mp, p);
-			break;
 		}
 	}