bridge: fix MAC address override on config reload
authorFelix Fietkau <nbd@nbd.name>
Tue, 22 Nov 2016 09:43:25 +0000 (10:43 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 22 Nov 2016 09:43:26 +0000 (10:43 +0100)
When no MAC address option is given, the MAC address of
bst->primary_port is used to override the bridge device address.
When the config changes and a new MAC address is provided in the config,
bridge_reset_primary needs to stop overriding it

Signed-off-by: Felix Fietkau <nbd@nbd.name>
bridge.c

index 30fd58d92065cd2516d27450f8dbfdb416fa18bd..ba1ce5d25e59e3b29ffe2c7c437254feccf5552e 100644 (file)
--- a/bridge.c
+++ b/bridge.c
@@ -655,6 +655,9 @@ bridge_reload(struct device *dev, struct blob_attr *attr)
        blobmsg_parse(bridge_attrs, __BRIDGE_ATTR_MAX, tb_br,
                blob_data(attr), blob_len(attr));
 
+       if (tb_dev[DEV_ATTR_MACADDR])
+               bst->primary_port = NULL;
+
        bst->ifnames = tb_br[BRIDGE_ATTR_IFNAME];
        device_init_settings(dev, tb_dev);
        bridge_apply_settings(bst, tb_br);