zero-initialize the ifreq when setting interfaces up or down
authorFelix Fietkau <nbd@openwrt.org>
Thu, 5 Jul 2012 16:16:31 +0000 (18:16 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 5 Jul 2012 16:16:31 +0000 (18:16 +0200)
system-linux.c

index c4d094d..24ea2e3 100644 (file)
@@ -350,6 +350,8 @@ static int system_if_resolve(struct device *dev)
 static int system_if_flags(const char *ifname, unsigned add, unsigned rem)
 {
        struct ifreq ifr;
+
+       memset(&ifr, 0, sizeof(ifr));
        strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
        ioctl(sock_ioctl, SIOCGIFFLAGS, &ifr);
        ifr.ifr_flags |= add;