[OpenWrt-Devel] [PATCH netifd] bridge: allow enabling or disabling the multicast querier independently of IGMP snooping

Matthias Schiffer mschiffer at universe-factory.net
Wed Jan 28 08:31:01 EST 2015


On 01/28/2015 01:59 PM, John Crispin wrote:
> 
> 
> On 27/01/2015 03:49, Matthias Schiffer wrote:
>> In larger networks, especially big batman-adv meshes, it may be desirable to
>> enable IGMP snooping on every bridge without enabling the multicast querier
>> to specifically put the querier on a well-connected node.
>>
>> This patch adds a new UCI option 'multicast_querier' for bridges which allows
>> this. The default is still the value of the 'igmp_snooping' option to maintain
>> backwards compatiblity.
>>
>> Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
>> ---
>>  bridge.c       | 8 +++++++-
>>  system-linux.c | 2 +-
>>  system.h       | 1 +
>>  3 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/bridge.c b/bridge.c
>> index f8478ad..f7dbf61 100644
> 
> [...]
> 
> 
>> @@ -560,7 +563,10 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb)
>>  		cfg->priority = blobmsg_get_u32(cur);
>>  
>>  	if ((cur = tb[BRIDGE_ATTR_IGMP_SNOOP]))
>> -		cfg->igmp_snoop = blobmsg_get_bool(cur);
>> +		cfg->multicast_querier = cfg->igmp_snoop = blobmsg_get_bool(cur);
>> +
>> +	if ((cur = tb[BRIDGE_ATTR_MULTICAST_QUERIER]))
>> +		cfg->multicast_querier = blobmsg_get_bool(cur);
>>  
> 
> how about this ?
> 
>   	if ((cur = tb[BRIDGE_ATTR_IGMP_SNOOP]))
> 		cfg->igmp_snoop = blobmsg_get_bool(cur);
> 
> 	if ((cur = tb[BRIDGE_ATTR_MULTICAST_QUERIER]))
> 		cfg->multicast_querier = blobmsg_get_bool(cur);
> 	else
> 		  cfg->multicast_querier = cfg->igmp_snoop;
> 
> 
> 
> 
> 
This will break when neither igmp_snoop and multicast_querier is set in
a ubus request, it will overwrite the multicast_querier setting with the
previous igmp_snoop setting. I realized that it is not possible to store
all needed cases in two booleans in the bridge_config (in my first
version I didn't think about dynamic reconfiguration at all...)


> 
>>  	if ((cur = tb[BRIDGE_ATTR_AGEING_TIME])) {
>>  		cfg->ageing_time = blobmsg_get_u32(cur);
>> diff --git a/system-linux.c b/system-linux.c
>> index 4737fa6..ef90880 100644
>> --- a/system-linux.c
>> +++ b/system-linux.c
>> @@ -772,7 +772,7 @@ int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg)
>>  		bridge->ifname, cfg->igmp_snoop ? "1" : "0");
>>  
>>  	system_set_dev_sysctl("/sys/devices/virtual/net/%s/bridge/multicast_querier",
>> -		bridge->ifname, cfg->igmp_snoop ? "1" : "0");
>> +		bridge->ifname, cfg->multicast_querier ? "1" : "0");
>>  
>>  	args[0] = BRCTL_SET_BRIDGE_PRIORITY;
>>  	args[1] = cfg->priority;
>> diff --git a/system.h b/system.h
>> index 9a2326b..94e0dd9 100644
>> --- a/system.h
>> +++ b/system.h
>> @@ -50,6 +50,7 @@ struct bridge_config {
>>  	enum bridge_opt flags;
>>  	bool stp;
>>  	bool igmp_snoop;
>> +	bool multicast_querier;
>>  	unsigned short priority;
>>  	int forward_delay;
>>  	bool bridge_empty;
>>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150128/81584daf/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list