summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormk <mk@openbsd.org>2006-11-10 20:04:24 +0000
committermk <mk@openbsd.org>2006-11-10 20:04:24 +0000
commitfa782e94c7f1e3295c5de9cff2162e4b0cb710eb (patch)
tree8f3b15642ee344d5c5855b1c4823ec218f568a55
parentregen (diff)
downloadwireguard-openbsd-fa782e94c7f1e3295c5de9cff2162e4b0cb710eb.tar.xz
wireguard-openbsd-fa782e94c7f1e3295c5de9cff2162e4b0cb710eb.zip
Add -nwid command to allow wireless interfaces to not prefer a specific
access point. Does the same as nwid "" but since we have -nwkey for nwkey etc. this is nice for consistency. ok mbalmer reyk man stuff also ok jmc
-rw-r--r--sbin/ifconfig/ifconfig.87
-rw-r--r--sbin/ifconfig/ifconfig.c15
2 files changed, 16 insertions, 6 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 4fd67af989e..f1f3d0fc4f5 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.136 2006/11/09 16:08:20 jmc Exp $
+.\" $OpenBSD: ifconfig.8,v 1.137 2006/11/10 20:04:24 mk Exp $
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\"
@@ -531,7 +531,7 @@ will begin advertising as master.
.Op Oo Fl Oc Cm bssid Ar bssid
.Op Oo Fl Oc Cm chan Ar n
.Op Oo Fl Oc Ns Cm nwflag Ar flag
-.Op Cm nwid Ar id
+.Op Oo Fl Oc Cm nwid Ar id
.Op Oo Fl Oc Cm nwkey Ar key
.Op Oo Fl Oc Cm powersave
.Op Cm powersavesleep Ar duration
@@ -597,6 +597,9 @@ or a series of hexadecimal digits up to 64 digits.
The empty string allows the interface to connect to any available
access points.
Note that network ID is synonymous with Extended Service Set ID (ESSID).
+.It Fl nwid
+Set the network ID to the empty string to allow the interface to connect
+to any available access point.
.It Cm nwkey Ar key
Enable WEP encryption for IEEE 802.11-based wireless network interfaces
using the specified
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 758c3c89992..8e97708b976 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.175 2006/09/30 23:44:17 ray Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.176 2006/11/10 20:04:24 mk Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -281,6 +281,7 @@ const struct cmd {
{ "metric", NEXTARG, 0, setifmetric },
{ "mtu", NEXTARG, 0, setifmtu },
{ "nwid", NEXTARG, 0, setifnwid },
+ { "-nwid", -1, 0, setifnwid },
{ "bssid", NEXTARG, 0, setifbssid },
{ "-bssid", -1, 0, setifbssid },
{ "nwkey", NEXTARG, 0, setifnwkey },
@@ -1307,9 +1308,15 @@ setifnwid(const char *val, int d)
struct ieee80211_nwid nwid;
int len;
- len = sizeof(nwid.i_nwid);
- if (get_string(val, NULL, nwid.i_nwid, &len) == NULL)
- return;
+ if (d != 0) {
+ /* no network id is especially desired */
+ memset(&nwid, 0, sizeof(nwid));
+ len = 0;
+ } else {
+ len = sizeof(nwid.i_nwid);
+ if (get_string(val, NULL, nwid.i_nwid, &len) == NULL)
+ return;
+ }
nwid.i_len = len;
(void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)&nwid;