summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2001-05-26 09:27:08 +0000
committerphk <phk@FreeBSD.org>2001-05-26 09:27:08 +0000
commit1aacce7a450370feff7a5e098c12e915e4f731f8 (patch)
treea706c2fc726d426b9f75667c81d6227ef2f9ea18 /sbin
parent2072a71f0e5186928f3cb8cfac61fe8199029442 (diff)
downloadFreeBSD-src-1aacce7a450370feff7a5e098c12e915e4f731f8.zip
FreeBSD-src-1aacce7a450370feff7a5e098c12e915e4f731f8.tar.gz
Currently, each wireless networking driver has it's own control program
despite the fact that most people want to set exactly the same settings regardless of which card they have. It has been repeatidly suggested that this configuration should be done via ifconfig. This patch implements the required functionality in ifconfig and add support to the wi and an drivers. It also provides partial, untested support for the awi driver. PR: 25577 Submitted by: Brooks Davis <brooks@one-eyed-alien.net>
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/Makefile4
-rw-r--r--sbin/ifconfig/ifconfig.8105
-rw-r--r--sbin/ifconfig/ifconfig.c26
-rw-r--r--sbin/ifconfig/ifconfig.h14
-rw-r--r--sbin/ifconfig/ifmedia.c36
5 files changed, 182 insertions, 3 deletions
diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile
index ea2b49d..457564a 100644
--- a/sbin/ifconfig/Makefile
+++ b/sbin/ifconfig/Makefile
@@ -15,6 +15,10 @@ SRCS+= ifvlan.c
CFLAGS+=-DUSE_VLANS
.endif
+#comment out to exclude SIOC[GS]IEEE80211 support
+SRCS+= ifieee80211.c
+CFLAGS+=-DUSE_IEEE80211
+
MAN= ifconfig.8
DPADD= ${LIBIPX}
LDADD= -lipx
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index d49f16d..3382a5d 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -413,6 +413,111 @@ This may be used to enable an interface after an
It happens automatically when setting the first address on an interface.
If the interface was reset when previously marked down,
the hardware will be re-initialized.
+.It Cm ssid Ar ssid
+For IEEE 802.11 wireless interfaces, set the desired Service Set
+Identifier (aka network name.) The SSID is a string up to 32 characters
+in length and may be specified as either a normal string or in
+hexadecimal when proceeded by
+.Sq 0x .
+Additionally, the SSID may be cleared by setting it to
+.Sq - .
+.It Cm nwid Ar ssid
+Another name for the
+.Dq ssid
+parameter. Included for NetBSD compatibility.
+.It Cm stationname Ar name
+For IEEE 802.11 wireless interfaces, set the name of this station.
+It appears that the station name is not really part of the IEEE 802.11
+protocol though all interfaces seem to support it. As such it only
+seems to be meaningful to identical or virtually identical equipment.
+Setting the station name is identical in syntax to setting the SSID.
+.It Cm station Ar name
+Another name for the
+.Dq stationname
+parameter. Included for BSD/OS compatibility.
+.It Cm channel Ar number
+For IEEE 802.11 wireless interfaces, set the desired channel.
+Channels range from 1 to 14, but the exact selection available
+depends on the region your adaptor was manufactured for. Setting
+the channel to 0 will give you the default for your adaptor. Many
+adaptors ignore this setting unless you are in ad-hoc mode.
+.It Cm authmode Ar mode
+For IEEE 802.11 wireless interfaces, set the desired authentication mode
+in infrastructure mode. Not all adaptors support all modes. The set of
+valid modes is
+.Dq none ,
+.Dq open ,
+and
+.Dq shared .
+Modes are case insensitive.
+.It Cm powersave
+For IEEE 802.11 wireless interfaces, enable powersave mode.
+.It Cm -powersave
+For IEEE 802.11 wireless interfaces, disable powersave mode.
+.It Cm powersavesleep Ar sleep
+For IEEE 802.11 wireless interfaces, set the desired max powersave sleep
+time in milliseconds.
+.It Cm wepmode Ar mode
+For IEEE 802.11 wireless interfaces, set the desired WEP mode. Not all
+adaptors support all modes. The set of valid modes is
+.Dq off ,
+.Dq on ,
+and
+.Dq mixed .
+.Dq Mixed
+mode explicitly tells the adaptor to allow association with access
+points which allow both encrypted and unencrypted traffic. On these
+adaptors,
+.Dq on
+means that the access point must only allow encrypted connections. On
+other adaptors,
+.Dq on
+is generally another name for
+.Dq mixed .
+Modes are case insensitive.
+.It Cm weptxkey Ar index
+For IEEE 802.11 wireless interfaces, set the WEP key to be used for
+transmission.
+.It Cm wepkey Ar key|index:key
+For IEEE 802.11 wireless interfaces, set the selected WEP key. If
+an
+.Ar index
+is not given, key 1 is set. A WEP key will be either 5 or 13
+characters (40 or 104 bits) depending of the local network and the
+capabilities of the adaptor. It may be specified either as a plain
+string or as a string of hexadecimal digits proceeded by
+.Sq 0x .
+A key may be cleared by setting it to
+.Sq - .
+If WEP is supported then there are at least four keys. Some adaptors
+support more then four keys. If that is the case, then the first four keys
+(1-4) will be the standard temporary keys and any others will be adaptor
+specific keys such as permanent keys stored in NVRAM.
+.It Cm wep
+Another way of saying
+.Dq wepmode on .
+Included for BSD/OS compatibility.
+.It Cm -wep
+Another way of saying
+.Dq wepmode off .
+Included for BSD/OS compatibility.
+.It Cm nwkey key
+Another way of saying:
+.Pp
+``wepmode on weptxkey 1 wepkey 1:key wepkey 2:- wepkey 3:- wepkey 4:-''.
+.Pp
+Included for NetBSD compatibility.
+.It Cm nwkey n:k1,k2,k3,k4
+Another way of saying
+.Pp
+``wepmode on weptxkey n wepkey 1:k1 wepkey 2:k2 wepkey 3:k3 wepkey 4:k4''.
+.Pp
+Included for NetBSD compatibility.
+.It Cm -nwkey
+Another way of saying
+.Dq wepmode off .
+.Pp
+Included for NetBSD compatibility.
.El
.Pp
.Nm Ifconfig
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 699c433..858221d 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -223,6 +223,25 @@ struct cmd {
{ "vlandev", NEXTARG, setvlandev },
{ "-vlandev", NEXTARG, unsetvlandev },
#endif
+#ifdef USE_IEEE80211
+ { "ssid", NEXTARG, set80211ssid },
+ { "nwid", NEXTARG, set80211ssid },
+ { "stationname", NEXTARG, set80211stationname },
+ { "station", NEXTARG, set80211stationname }, /* BSD/OS */
+ { "channel", NEXTARG, set80211channel },
+ { "authmode", NEXTARG, set80211authmode },
+ { "powersavemode", NEXTARG, set80211powersavemode },
+ { "powersave", 1, set80211powersave },
+ { "-powersave", 0, set80211powersave },
+ { "powersavesleep", NEXTARG, set80211powersavesleep },
+ { "wepmode", NEXTARG, set80211wepmode },
+ { "wep", 1, set80211wep },
+ { "-wep", 0, set80211wep },
+ { "weptxkey", NEXTARG, set80211weptxkey },
+ { "wepkey", NEXTARG, set80211wepkey },
+ { "nwkey", NEXTARG, set80211nwkey }, /* NetBSD */
+ { "-nwkey", 0, set80211wep }, /* NetBSD */
+#endif
{ "normal", -IFF_LINK0, setifflags },
{ "compress", IFF_LINK0, setifflags },
{ "noicmp", IFF_LINK1, setifflags },
@@ -291,6 +310,9 @@ struct afswtch {
#ifdef USE_VLANS
{ "vlan", AF_UNSPEC, vlan_status, NULL, NULL, }, /* XXX not real!! */
#endif
+#ifdef USE_IEEE80211
+ { "ieee80211", AF_UNSPEC, ieee80211_status, NULL, NULL, }, /* XXX not real!! */
+#endif
#endif
{ 0, 0, 0, 0 }
};
@@ -970,6 +992,10 @@ status(afp, addrcount, sdl, ifm, ifam)
if (allfamilies || afp->af_status == vlan_status)
vlan_status(s, NULL);
#endif
+#ifdef USE_IEEE80211
+ if (allfamilies || afp->af_status == ieee80211_status)
+ ieee80211_status(s, NULL);
+#endif
strncpy(ifs.ifs_name, name, sizeof ifs.ifs_name);
if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0)
printf("%s", ifs.ascii);
diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h
index 88b9503..4931643 100644
--- a/sbin/ifconfig/ifconfig.h
+++ b/sbin/ifconfig/ifconfig.h
@@ -49,3 +49,17 @@ extern void setvlantag(const char *, int, int, const struct afswtch *rafp);
extern void setvlandev(const char *, int, int, const struct afswtch *rafp);
extern void unsetvlandev(const char *, int, int, const struct afswtch *rafp);
extern void vlan_status(int s, struct rt_addrinfo *);
+
+extern void set80211ssid(const char *, int, int, const struct afswtch *rafp);
+extern void set80211stationname(const char *, int, int, const struct afswtch *rafp);
+extern void set80211channel(const char *, int, int, const struct afswtch *rafp);
+extern void set80211authmode(const char *, int, int, const struct afswtch *rafp);
+extern void set80211powersave(const char *, int, int, const struct afswtch *rafp);
+extern void set80211powersavemode(const char *, int, int, const struct afswtch *rafp);
+extern void set80211powersavesleep(const char *, int, int, const struct afswtch *rafp);
+extern void set80211wepmode(const char *, int, int, const struct afswtch *rafp);
+extern void set80211wep(const char *, int, int, const struct afswtch *rafp);
+extern void set80211weptxkey(const char *, int, int, const struct afswtch *rafp);
+extern void set80211wepkey(const char *, int, int, const struct afswtch *rafp);
+extern void set80211nwkey(const char *, int, int, const struct afswtch *rafp);
+extern void ieee80211_status(int s, struct rt_addrinfo *);
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index 3ab28f8..0e770f7 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -152,6 +152,13 @@ media_status(s, info)
else
printf("no ring");
break;
+ case IFM_IEEE80211:
+ /* XXX: Different value for adhoc? */
+ if (ifmr.ifm_status & IFM_ACTIVE)
+ printf("associated");
+ else
+ printf("no carrier");
+ break;
}
}
@@ -318,6 +325,15 @@ static struct ifmedia_description ifm_subtype_fddi_aliases[] =
static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
+static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
+ IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
+
+static struct ifmedia_description ifm_subtype_ieee80211_aliases[] =
+ IFM_SUBTYPE_IEEE80211_ALIASES;
+
+static struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] =
+ IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS;
+
static struct ifmedia_description ifm_subtype_shared_descriptions[] =
IFM_SUBTYPE_SHARED_DESCRIPTIONS;
@@ -350,7 +366,7 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
},
{
{ &ifm_shared_option_descriptions[0], 0 },
- { &ifm_subtype_ethernet_option_descriptions[0], 1 },
+ { &ifm_subtype_ethernet_option_descriptions[0], 0 },
{ NULL, 0 },
},
},
@@ -364,7 +380,7 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
},
{
{ &ifm_shared_option_descriptions[0], 0 },
- { &ifm_subtype_tokenring_option_descriptions[0], 1 },
+ { &ifm_subtype_tokenring_option_descriptions[0], 0 },
{ NULL, 0 },
},
},
@@ -378,7 +394,21 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
},
{
{ &ifm_shared_option_descriptions[0], 0 },
- { &ifm_subtype_fddi_option_descriptions[0], 1 },
+ { &ifm_subtype_fddi_option_descriptions[0], 0 },
+ { NULL, 0 },
+ },
+ },
+ {
+ {
+ { &ifm_subtype_shared_descriptions[0], 0 },
+ { &ifm_subtype_shared_aliases[0], 1 },
+ { &ifm_subtype_ieee80211_descriptions[0], 0 },
+ { &ifm_subtype_ieee80211_aliases[0], 1 },
+ { NULL, 0 },
+ },
+ {
+ { &ifm_shared_option_descriptions[0], 0 },
+ { &ifm_subtype_ieee80211_option_descriptions[0], 0 },
{ NULL, 0 },
},
},
OpenPOWER on IntegriCloud