summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2016-12-20 13:26:24 +0000
committerstsp <stsp@openbsd.org>2016-12-20 13:26:24 +0000
commit32ed6bd5f3b6f10a4d38de012ee046db9dc8be9b (patch)
treee0c21791c76695c7e476d8015fb990514aa68f45
parentRemove duplicate in_ioctl() prototype, it is in in_var.h now. (diff)
downloadwireguard-openbsd-32ed6bd5f3b6f10a4d38de012ee046db9dc8be9b.tar.xz
wireguard-openbsd-32ed6bd5f3b6f10a4d38de012ee046db9dc8be9b.zip
Make 'ifconfig if0 wpa' and 'ifconfig if0 -wpa' reset WPA params (does not
include the wpakey) to their defaults. And make 'ifconfig if0 wpaprotos' reset WPA crypto parameters to settings which are appropriate for the specified WPA protocol version.
-rw-r--r--sbin/ifconfig/ifconfig.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index f84cbf659f3..bd98db2bfc5 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.334 2016/12/13 01:36:21 dlg Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.335 2016/12/20 13:26:24 stsp Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -1723,8 +1723,7 @@ setifwpa(const char *val, int d)
memset(&wpa, 0, sizeof(wpa));
(void)strlcpy(wpa.i_name, name, sizeof(wpa.i_name));
- if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) < 0)
- err(1, "SIOCG80211WPAPARMS");
+ /* Don't read current values. The kernel will set defaults. */
wpa.i_enabled = d;
if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) < 0)
err(1, "SIOCS80211WPAPARMS");
@@ -1757,6 +1756,9 @@ setifwpaprotos(const char *val, int d)
if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) < 0)
err(1, "SIOCG80211WPAPARMS");
wpa.i_protos = rval;
+ /* Let the kernel set up the appropriate default ciphers. */
+ wpa.i_ciphers = 0;
+ wpa.i_groupcipher = 0;
if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) < 0)
err(1, "SIOCS80211WPAPARMS");
}