On 06/04/17 23:44, Ido Schimmel wrote: > On Thu, Apr 06, 2017 at 11:26:06PM +0300, Nikolay Aleksandrov wrote: >> Actually making br_vlan_init() idempotent might work, keep the code as-is >> just init the >> the vlans before the changelink() in newlink(), then the second vlan_init() >> inside would >> be a no-op, but it will work for the old ioctl and wouldn't require too much >> change. >> On the downside it will be ugly. > > Yep, that can work. I'll try that tomorrow morning and let you know. > > Thanks Nik! >
Great, thanks, just one more thing to keep in mind. The vlan add would try to add the bridge mac address which in turn will generate a notification with ifindex = 0 since it will get assigned during register_netdevice() later. The only way to get correct behaviour seems to make the changelink() opportunistic and move it after the netdevice_register(), though that may cause a device which is half configured if something's wrong with the config, but the good thing with the bridge is that everything can be set during runtime so no need to destroy/make it again.