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 <rpaulo@FreeBSD.org>
This commit is contained in:
Rui Paulo 2013-08-07 10:54:16 +03:00 committed by Jouni Malinen
parent 7239ea7f01
commit cb76af8a35

View file

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