]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
bsd: Skip SIOCSIFFFLAGS ioctl when there is no change.
authorRui Paulo <rpaulo@FreeBSD.org>
Wed, 7 Aug 2013 07:54:16 +0000 (10:54 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 7 Aug 2013 07:54:16 +0000 (10:54 +0300)
Don't issue SIOCSIFFLAGS if the interface is already up or already down.

Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>

src/drivers/driver_bsd.c

index 9d869b1517a597d5d26a22f0e88e5ae622e57ccf..a80a9ac7bac6c109c49cf71503224506a003018a 100644 (file)
@@ -265,10 +265,15 @@ bsd_ctrl_iface(void *priv, int enable)
                return -1;
        }
 
-       if (enable)
+       if (enable) {
+               if (ifr.ifr_flags & IFF_UP)
+                       return 0;
                ifr.ifr_flags |= IFF_UP;
-       else
+       } else {
+               if (!(ifr.ifr_flags & IFF_UP))
+                       return 0;
                ifr.ifr_flags &= ~IFF_UP;
+       }
 
        if (ioctl(drv->sock, SIOCSIFFLAGS, &ifr) < 0) {
                perror("ioctl[SIOCSIFFLAGS]");