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:
parent
7239ea7f01
commit
cb76af8a35
1 changed files with 7 additions and 2 deletions
|
@ -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]");
|
||||
|
|
Loading…
Reference in a new issue