I have a laptop on which I have setup a bridge interface between the Ethernet and WiFi devices in order to connect non-WiFi devices to the network before they go into their final, wired, position. I use the bridge instead of forwarding/routing because it allows ARP and broadcasts through. In order for this to work I manually enable 4addr mode each time I activate the bridge: iw dev wlp3s0 set 4addr on and it is important to note that the WiFi network also has to support this.
I would like to automate this and have tried with various methods:
- NetworkManager dispatcher.d scripts (pre-up as well)
- udev rule
The problem with the first one is that the dispatcher.d script (both normal and pre-up) run after the device has connected to the SSID by which point it is too late to enable 4addr. The second approach is too broad and just turns on 4addr on boot, which means I can't connect to any WiFi networks that don't support 4addr.
Is there a way to set 4addr mode (or just run a script) before NetworkManager tells the WLAN card to connect to a specified network?