Re: [PATCH net-next] bridge: Synchronize unicast filtering with FDB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2016/06/04 2:35, Nikolay Aleksandrov wrote:
...
>>> void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
>>> @@ -288,6 +296,95 @@ out:
>>> 	spin_unlock_bh(&br->hash_lock);
>>> }
>>>
>>> +void br_fdb_sync_uc(struct net_bridge *br)
>>> +{
>>> +	struct net_bridge_vlan_group *vg;
>>> +	struct netdev_hw_addr *ha;
>>> +	int i;
>>> +
>>> +	spin_lock_bh(&br->hash_lock);
>>> +
>>> +	for (i = 0; i < BR_HASH_SIZE; i++) {
>>> +		struct hlist_node *h;
>>> +
>>> +		hlist_for_each(h, &br->hash[i]) {
>>> +			struct net_bridge_fdb_entry *f;
>>> +
>>> +			f = hlist_entry(h, struct net_bridge_fdb_entry, hlist);
>>> +			if (!f->dst && f->is_local && !f->added_by_user &&
>>> +			    !ether_addr_equal(f->addr.addr, br->dev->dev_addr)) {
>>> +				/* delete old one */
>>> +				fdb_delete_local(br, NULL, f);
>>> +			}
>>> +		}
>>> +	}
>>> +
>>> +	vg = br_vlan_group(br);
>>> +
>>> +	/* insert new address,  may fail if invalid address or dup. */
>>> +	netdev_for_each_uc_addr(ha, br->dev) {
>>> +		struct net_bridge_vlan *v;
>>> +
>>> +		fdb_insert(br, NULL, ha->addr, 0);
>>> +
>>> +		if (!vg || !vg->num_vlans)
>>> +			continue;
>>> +
>>> +		list_for_each_entry(v, &vg->vlan_list, vlist)
>>> +			fdb_insert(br, NULL, ha->addr, v->vid);
>>
>> Since here you’re walking over the bridge’s vlan list, you should test the vlans with br_vlan_should_use()
>> because it can be a global context holder if the vlan was configured only on ports.

Thank you for your feedback.
will fix in v2.

I actually thought that this is the same logic as
br_fdb_change_mac_address() so assumed it should be all right.
Does br_fdb_change_mac_address() need br_vlan_should_use() as well?

Toshiaki Makita





[Index of Archives]     [Netdev]     [AoE Tools]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux