diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-01-22 19:11:19 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-01-22 19:11:24 +0100 |
commit | ccac483fb60917eb83765b4942a9c778c017471a (patch) | |
tree | ed3ad8a07c7c60b0def992fd62332aa833961ee2 | |
parent | 1466967ffa3e408b709d5e84932616787b2853ac (diff) |
remove flags for device settings that could not be applied successfully
-rw-r--r-- | system-linux.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/system-linux.c b/system-linux.c index 34d7cae..aa3aeda 100644 --- a/system-linux.c +++ b/system-linux.c @@ -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; } } |