summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2019-01-18 20:40:01 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2019-01-18 20:40:01 +0000
commit24bc8461e879ead6c8d42cbee79cc8e209fd0dc2 (patch)
treebb88badea74a63f0e2c826e6dab3b2482fb5b360
parent8a5c090f6bc53835dfb3debab107b635f4152168 (diff)
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;
}