From: Felix Fietkau Date: Sun, 22 Jan 2012 18:11:19 +0000 (+0100) Subject: remove flags for device settings that could not be applied successfully X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ccac483fb60917eb83765b4942a9c778c017471a;p=oweals%2Fnetifd.git remove flags for device settings that could not be applied successfully --- 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; } }