summaryrefslogtreecommitdiff
path: root/sbin/ifconfig/ifconfig.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2016-12-20 13:26:25 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2016-12-20 13:26:25 +0000
commitcd6eb834a5be29846f7acebb766ecdaeae0fbb16 (patch)
tree00f853334e39b2d0d97c1cbd3a7bfaeaaedde186 /sbin/ifconfig/ifconfig.c
parentd916b330c0d05bcc9a959dfd8945ad4de4c31b68 (diff)
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.
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-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");
}