summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2018-08-06 11:42:19 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2018-08-06 11:42:19 +0000
commit6a9e8f473c9b49dc81108ab48d0209cb4ce42241 (patch)
treed6588169d5a3a420c19dedd9bd9284a9a0efaef0 /sys/net80211/ieee80211_ioctl.c
parent8a942ff219550e8037c532317e798dc6542949ce (diff)
make ifconfig <if> join display the list of networks configured for
auto-join with feedback from florian and stsp ok florian@ phessler@ (on previous versions of the diff) stsp@
Diffstat (limited to 'sys/net80211/ieee80211_ioctl.c')
-rw-r--r--sys/net80211/ieee80211_ioctl.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 40791460678..2ff4c10d267 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.62 2018/08/06 11:28:01 stsp Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.63 2018/08/06 11:42:18 benno Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -391,8 +391,10 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct ieee80211com *ic = (void *)ifp;
struct ifreq *ifr = (struct ifreq *)data;
int i, error = 0;
+ size_t len;
struct ieee80211_nwid nwid;
struct ieee80211_join join;
+ struct ieee80211_joinreq_all *ja;
struct ieee80211_ess *ess;
struct ieee80211_wpapsk *psk;
struct ieee80211_keyavail *ka;
@@ -488,6 +490,25 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
}
break;
+ case SIOCG80211JOINALL:
+ ja = (struct ieee80211_joinreq_all *)data;
+ ja->ja_nodes = len = 0;
+ TAILQ_FOREACH(ess, &ic->ic_ess, ess_next) {
+ if (len + sizeof(ja->ja_node[0]) >= ja->ja_size) {
+ error = E2BIG;
+ break;
+ }
+ memset(&join, 0, sizeof(join));
+ join.i_len = ess->esslen;
+ memcpy(&join.i_nwid, ess->essid, join.i_len);
+ error = copyout(&join, &ja->ja_node[ja->ja_nodes],
+ sizeof(ja->ja_node[0]));
+ if (error)
+ break;
+ len += sizeof(join);
+ ja->ja_nodes++;
+ }
+ break;
case SIOCS80211NWKEY:
if ((error = suser(curproc)) != 0)
break;