summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphessler <phessler@openbsd.org>2019-01-18 20:40:00 +0000
committerphessler <phessler@openbsd.org>2019-01-18 20:40:00 +0000
commit52300c1e95d4b83d350ed9ccd11aa70376967ec7 (patch)
treebe82ec4ed169b2d46bd6b42c05bed943aa598507
parentadd a len field when we delete an essid from the joinlist. this will have (diff)
downloadwireguard-openbsd-52300c1e95d4b83d350ed9ccd11aa70376967ec7.tar.xz
wireguard-openbsd-52300c1e95d4b83d350ed9ccd11aa70376967ec7.zip
when removing the currently active network from the join list, disconnect
from it as well OK stsp@
-rw-r--r--sys/net80211/ieee80211_ioctl.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 389e40e02d2..a57df7f8f6b 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.71 2019/01/18 20:28:40 phessler Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.72 2019/01/18 20:40:00 phessler Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -509,12 +509,29 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = EINVAL;
break;
}
- if (join.i_flags & IEEE80211_JOIN_DEL)
+ if (join.i_flags & IEEE80211_JOIN_DEL) {
+ int update_ic = 0;
+ if (ic->ic_des_esslen == join.i_len &&
+ memcmp(join.i_nwid, ic->ic_des_essid,
+ join.i_len) == 0)
+ update_ic = 1;
+ if (join.i_flags & IEEE80211_JOIN_DEL_ALL &&
+ ieee80211_get_ess(ic, ic->ic_des_essid,
+ ic->ic_des_esslen) != NULL)
+ update_ic = 1;
ieee80211_del_ess(ic, join.i_nwid, join.i_len,
join.i_flags & IEEE80211_JOIN_DEL_ALL ? 1 : 0);
-
- /* save nwid for auto-join */
- if (!(join.i_flags & IEEE80211_JOIN_DEL)) {
+ if (update_ic == 1) {
+ /* Unconfigure this essid */
+ memset(ic->ic_des_essid, 0, IEEE80211_NWID_LEN);
+ ic->ic_des_esslen = 0;
+ /* disable WPA/WEP */
+ ieee80211_disable_rsn(ic);
+ ieee80211_disable_wep(ic);
+ error = ENETRESET;
+ }
+ } else {
+ /* save nwid for auto-join */
if (ieee80211_add_ess(ic, &join) == 0)
ic->ic_flags |= IEEE80211_F_AUTO_JOIN;
}