From: Rui Paulo Date: Wed, 7 Aug 2013 07:54:16 +0000 (+0300) Subject: bsd: Skip SIOCSIFFFLAGS ioctl when there is no change. X-Git-Tag: aosp-kk-from-upstream~99 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb76af8a35a46146fbc324d28b06c50317c7197b;p=thirdparty%2Fhostap.git bsd: Skip SIOCSIFFFLAGS ioctl when there is no change. Don't issue SIOCSIFFLAGS if the interface is already up or already down. Signed-hostap: Rui Paulo --- diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c index 9d869b151..a80a9ac7b 100644 --- a/src/drivers/driver_bsd.c +++ b/src/drivers/driver_bsd.c @@ -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]");