summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphessler <phessler@openbsd.org>2018-10-27 09:55:26 +0000
committerphessler <phessler@openbsd.org>2018-10-27 09:55:26 +0000
commit6aa27acd9959d2abe48b542e7b4571ba1ed176f6 (patch)
treed8c04f698675b816757776179f59e2b3bb408ec2
parentdon't join to a network where we expect cleartext, and the AP is using crypto (diff)
downloadwireguard-openbsd-6aa27acd9959d2abe48b542e7b4571ba1ed176f6.tar.xz
wireguard-openbsd-6aa27acd9959d2abe48b542e7b4571ba1ed176f6.zip
clean up accounting of the AUTO_JOIN flag by making sure it is set or cleared
based on the state of the joinlist OK stsp@
-rw-r--r--sys/net80211/ieee80211_ioctl.c4
-rw-r--r--sys/net80211/ieee80211_node.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index fa2cb09259e..500a5306b06 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.67 2018/09/10 11:07:43 phessler Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.68 2018/10/27 09:55:26 phessler Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -434,7 +434,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (ic->ic_des_esslen > 0) {
/* 'nwid' disables auto-join magic */
ic->ic_flags &= ~IEEE80211_F_AUTO_JOIN;
- } else {
+ } else if (!TAILQ_EMPTY(&ic->ic_ess)) {
/* '-nwid' re-enables auto-join */
ic->ic_flags |= IEEE80211_F_AUTO_JOIN;
}
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index d7b941cf9c6..9f485c0e6cb 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.c,v 1.153 2018/10/27 09:47:36 phessler Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.154 2018/10/27 09:55:26 phessler Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
@@ -201,6 +201,8 @@ ieee80211_del_ess(struct ieee80211com *ic, char *nwid, int all)
TAILQ_REMOVE(&ic->ic_ess, ess, ess_next);
explicit_bzero(ess, sizeof(*ess));
free(ess, M_DEVBUF, sizeof(*ess));
+ if (TAILQ_EMPTY(&ic->ic_ess))
+ ic->ic_flags &= ~IEEE80211_F_AUTO_JOIN;
if (all != 1)
return;
}