Browse Source

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>
Rui Paulo 11 years ago
parent
commit
cb76af8a35
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/drivers/driver_bsd.c

+ 7 - 2
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]");