summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2017-03-11 13:22:36 +0000
committerstsp <stsp@openbsd.org>2017-03-11 13:22:36 +0000
commit849fcdcaa8377797cf80a9fd3acda80e74ee615d (patch)
tree4c824f12027a061a3b2c25205a8c9b872dff01b1
parentAdd a detachhook to pfsync(4) which deals with the syncdev going away. (diff)
downloadwireguard-openbsd-849fcdcaa8377797cf80a9fd3acda80e74ee615d.tar.xz
wireguard-openbsd-849fcdcaa8377797cf80a9fd3acda80e74ee615d.zip
Make 'ifconfig scan' display AP encryption correctly if WEP is configured
on the local wifi interface. ifconfig was mistakenly showing the common supported subset of client and AP, rather than showing the AP's capabilities. Exposes WPA protocol capabilities in struct ieee80211_nodereq, which means ifconfig must be recompiled to run on a new kernel. ok deraadt@ mpi@
-rw-r--r--sbin/ifconfig/ifconfig.c6
-rw-r--r--sys/net80211/ieee80211_ioctl.c7
-rw-r--r--sys/net80211/ieee80211_ioctl.h3
3 files changed, 11 insertions, 5 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 758f2f7faeb..c5db44c1c1b 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.337 2017/01/21 08:31:44 krw Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.338 2017/03/11 13:22:36 stsp Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -2375,9 +2375,9 @@ ieee80211_printnode(struct ieee80211_nodereq *nr)
if (nr->nr_capinfo) {
printb_status(nr->nr_capinfo, IEEE80211_CAPINFO_BITS);
if (nr->nr_capinfo & IEEE80211_CAPINFO_PRIVACY) {
- if (nr->nr_rsnciphers & IEEE80211_WPA_CIPHER_CCMP)
+ if (nr->nr_rsnprotos & IEEE80211_WPA_PROTO_WPA2)
fputs(",wpa2", stdout);
- else if (nr->nr_rsnciphers & IEEE80211_WPA_CIPHER_TKIP)
+ else if (nr->nr_rsnprotos & IEEE80211_WPA_PROTO_WPA1)
fputs(",wpa1", stdout);
else
fputs(",wep", stdout);
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 971d21f620d..08ba495e096 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.c,v 1.48 2017/01/19 01:07:35 stsp Exp $ */
+/* $OpenBSD: ieee80211_ioctl.c,v 1.49 2017/03/11 13:22:36 stsp Exp $ */
/* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */
/*-
@@ -107,6 +107,11 @@ ieee80211_node2req(struct ieee80211com *ic, const struct ieee80211_node *ni,
/* RSN */
nr->nr_rsnciphers = ni->ni_rsnciphers;
nr->nr_rsnakms = 0;
+ nr->nr_rsnprotos = 0;
+ if (ni->ni_rsnprotos & IEEE80211_PROTO_WPA)
+ nr->nr_rsnprotos |= IEEE80211_WPA_PROTO_WPA1;
+ if (ni->ni_rsnprotos & IEEE80211_PROTO_RSN)
+ nr->nr_rsnprotos |= IEEE80211_WPA_PROTO_WPA2;
if (ni->ni_rsnakms & IEEE80211_AKM_8021X)
nr->nr_rsnakms |= IEEE80211_WPA_AKM_8021X;
if (ni->ni_rsnakms & IEEE80211_AKM_PSK)
diff --git a/sys/net80211/ieee80211_ioctl.h b/sys/net80211/ieee80211_ioctl.h
index 3ab99117681..0151b6962db 100644
--- a/sys/net80211/ieee80211_ioctl.h
+++ b/sys/net80211/ieee80211_ioctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_ioctl.h,v 1.27 2016/08/15 22:14:19 stsp Exp $ */
+/* $OpenBSD: ieee80211_ioctl.h,v 1.28 2017/03/11 13:22:36 stsp Exp $ */
/* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */
/*-
@@ -328,6 +328,7 @@ struct ieee80211_nodereq {
u_int16_t nr_state; /* node state in the cache */
/* RSN */
+ u_int nr_rsnprotos;
u_int nr_rsnciphers;
u_int nr_rsnakms;