system-linux: set master early on apply settings
authorChristian Marangi <[email protected]>
Tue, 12 Dec 2023 00:14:25 +0000 (01:14 +0100)
committerFelix Fietkau <[email protected]>
Thu, 4 Jan 2024 12:35:39 +0000 (13:35 +0100)
Move master setting up before anything as settings may gets reset on
master change.

Signed-off-by: Christian Marangi <[email protected]>
system-linux.c

index 96cc99397100b2c7a2412f23e112c38203e912c4..0137386dd0d005a222e9a08e94665f2071b1caa0 100644 (file)
@@ -2248,6 +2248,15 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, uint64_t
 
        apply_mask &= s->flags;
 
+       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);
+#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
+       }
+
        memset(&ifr, 0, sizeof(ifr));
        strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
        if (apply_mask & DEV_OPT_MTU) {
@@ -2336,14 +2345,6 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, uint64_t
                system_set_drop_unsolicited_na(dev, s->drop_unsolicited_na ? "1" : "0");
        if (apply_mask & DEV_OPT_ARP_ACCEPT)
                system_set_arp_accept(dev, s->arp_accept ? "1" : "0");
-       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);
-#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
-       }
        system_set_ethtool_settings(dev, s);
 }