remove flags for device settings that could not be applied successfully
authorFelix Fietkau <nbd@openwrt.org>
Sun, 22 Jan 2012 18:11:19 +0000 (19:11 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 22 Jan 2012 18:11:24 +0000 (19:11 +0100)
system-linux.c

index 34d7cae30d4592ff5fbc1e3bb98029565211ba7e..aa3aedaaa30b6e3e983e6a5ef550bbec7b9f7c72 100644 (file)
@@ -602,15 +602,18 @@ system_if_apply_settings(struct device *dev, struct device_settings *s)
        strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name));
        if (s->flags & DEV_OPT_MTU) {
                ifr.ifr_mtu = s->mtu;
-               ioctl(sock_ioctl, SIOCSIFMTU, &ifr);
+               if (ioctl(sock_ioctl, SIOCSIFMTU, &ifr) < 0)
+                       s->flags &= ~DEV_OPT_MTU;
        }
        if (s->flags & DEV_OPT_TXQUEUELEN) {
                ifr.ifr_qlen = s->txqueuelen;
-               ioctl(sock_ioctl, SIOCSIFTXQLEN, &ifr);
+               if (ioctl(sock_ioctl, SIOCSIFTXQLEN, &ifr) < 0)
+                       s->flags &= ~DEV_OPT_TXQUEUELEN;
        }
        if (s->flags & DEV_OPT_MACADDR) {
                memcpy(&ifr.ifr_hwaddr, s->macaddr, sizeof(s->macaddr));
-               ioctl(sock_ioctl, SIOCSIFHWADDR, &ifr);
+               if (ioctl(sock_ioctl, SIOCSIFHWADDR, &ifr) < 0)
+                       s->flags &= ~DEV_OPT_MACADDR;
        }
 }