system-linux: skip refreshing MAC on master change if custom MAC
[project/netifd.git] / 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