Skip to content

Commit c973901

Browse files
Nikolay Aleksandrovkuba-moo
authored andcommitted
net: bridge: multicast: add EHT host filter_mode handling
We should be able to handle host filter mode changing. For exclude mode we must create a zero-src entry so the group will be kept even without any S,G entries (non-zero source sets). That entry doesn't count to the entry limit and can always be created, its timer is refreshed on new exclude reports and if we change the host filter mode to include then it gets removed and we rely only on the non-zero source sets. Signed-off-by: Nikolay Aleksandrov <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b66bf55 commit c973901

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

net/bridge/br_multicast_eht.c

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,30 @@ static void br_multicast_ip_src_to_eht_addr(const struct br_ip *src,
381381
}
382382
}
383383

384+
static void br_eht_convert_host_filter_mode(struct net_bridge_port_group *pg,
385+
union net_bridge_eht_addr *h_addr,
386+
int filter_mode)
387+
{
388+
struct net_bridge_group_eht_host *eht_host;
389+
union net_bridge_eht_addr zero_addr;
390+
391+
eht_host = br_multicast_eht_host_lookup(pg, h_addr);
392+
if (eht_host)
393+
eht_host->filter_mode = filter_mode;
394+
395+
memset(&zero_addr, 0, sizeof(zero_addr));
396+
switch (filter_mode) {
397+
case MCAST_INCLUDE:
398+
br_multicast_del_eht_set_entry(pg, &zero_addr, h_addr);
399+
break;
400+
case MCAST_EXCLUDE:
401+
br_multicast_create_eht_set_entry(pg, &zero_addr, h_addr,
402+
MCAST_EXCLUDE,
403+
true);
404+
break;
405+
}
406+
}
407+
384408
static void br_multicast_create_eht_set_entry(struct net_bridge_port_group *pg,
385409
union net_bridge_eht_addr *src_addr,
386410
union net_bridge_eht_addr *h_addr,
@@ -701,8 +725,13 @@ static bool br_multicast_eht_inc(struct net_bridge_port_group *pg,
701725
size_t addr_size,
702726
bool to_report)
703727
{
704-
return __eht_inc_exc(pg, h_addr, srcs, nsrcs, addr_size, MCAST_INCLUDE,
705-
to_report);
728+
bool changed;
729+
730+
changed = __eht_inc_exc(pg, h_addr, srcs, nsrcs, addr_size,
731+
MCAST_INCLUDE, to_report);
732+
br_eht_convert_host_filter_mode(pg, h_addr, MCAST_INCLUDE);
733+
734+
return changed;
706735
}
707736

708737
static bool br_multicast_eht_exc(struct net_bridge_port_group *pg,
@@ -712,8 +741,13 @@ static bool br_multicast_eht_exc(struct net_bridge_port_group *pg,
712741
size_t addr_size,
713742
bool to_report)
714743
{
715-
return __eht_inc_exc(pg, h_addr, srcs, nsrcs, addr_size, MCAST_EXCLUDE,
716-
to_report);
744+
bool changed;
745+
746+
changed = __eht_inc_exc(pg, h_addr, srcs, nsrcs, addr_size,
747+
MCAST_EXCLUDE, to_report);
748+
br_eht_convert_host_filter_mode(pg, h_addr, MCAST_EXCLUDE);
749+
750+
return changed;
717751
}
718752

719753
static bool __eht_ip4_handle(struct net_bridge_port_group *pg,

0 commit comments

Comments
 (0)