system-linux: skip refreshing MAC on master change if custom MAC
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 12 Dec 2023 00:15:55 +0000 (01:15 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 12 Dec 2023 00:17:23 +0000 (01:17 +0100)
If custom MAC or a default MAC needs to be applied, skip refreshing MAC
after master change to correctly apply the custom MAC.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
system-linux.c

index b64c00755606330d1f8acb9df6c68ee9867a4eba..e7945e3330a80fd14824bfd83bd7f50501c5f6ed 100644 (file)
@@ -2262,7 +2262,8 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, uint64_t
        if (apply_mask & DEV_OPT_MASTER) {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)
                system_set_master(dev, s->master_ifindex);
-               system_refresh_orig_macaddr(dev, &dev->orig_settings);
+               if (!(apply_mask & (DEV_OPT_MACADDR | DEV_OPT_DEFAULT_MACADDR)) || dev->external)
+                       system_refresh_orig_macaddr(dev, &dev->orig_settings);
 #else
                netifd_log_message(L_WARNING, "%s Your kernel is older than linux 6.1.0, changing DSA port conduit is not supported!", dev->ifname);
 #endif