summaryrefslogtreecommitdiffstats
path: root/sys/net
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 /sys/net
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 'sys/net')
-rw-r--r--sys/net/if_ieee80211.h39
-rw-r--r--sys/net/if_media.c10
-rw-r--r--sys/net/if_media.h54
3 files changed, 100 insertions, 3 deletions
diff --git a/sys/net/if_ieee80211.h b/sys/net/if_ieee80211.h
index a95498f..a6e866e 100644
--- a/sys/net/if_ieee80211.h
+++ b/sys/net/if_ieee80211.h
@@ -229,4 +229,43 @@ struct ieee80211_nwkey {
#define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey)
#define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey)
+#define IEEE80211_WEP_NOSUP -1
+#define IEEE80211_WEP_OFF 0
+#define IEEE80211_WEP_ON 1
+#define IEEE80211_WEP_MIXED 2
+
+#define IEEE80211_AUTH_NONE 0
+#define IEEE80211_AUTH_OPEN 1
+#define IEEE80211_AUTH_SHARED 2
+
+#define IEEE80211_POWERSAVE_NOSUP -1
+#define IEEE80211_POWERSAVE_OFF 0
+#define IEEE80211_POWERSAVE_CAM 1
+#define IEEE80211_POWERSAVE_PSP 2
+#define IEEE80211_POWERSAVE_PSP_CAM 3
+#define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM
+
+/* the first member must be matched with struct ifreq */
+struct ieee80211req {
+ char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
+ u_int16_t i_type; /* req type */
+ int16_t i_val; /* Index or simple value */
+ int16_t i_len; /* Index or simple value */
+ void *i_data; /* Extra data */
+};
+#define SIOCS80211 _IOW('i', 234, struct ieee80211req)
+#define SIOCG80211 _IOWR('i', 235, struct ieee80211req)
+
+#define IEEE80211_IOC_SSID 1
+#define IEEE80211_IOC_NUMSSIDS 2
+#define IEEE80211_IOC_WEP 3
+#define IEEE80211_IOC_WEPKEY 4
+#define IEEE80211_IOC_NUMWEPKEYS 5
+#define IEEE80211_IOC_WEPTXKEY 6
+#define IEEE80211_IOC_AUTHMODE 7
+#define IEEE80211_IOC_STATIONNAME 8
+#define IEEE80211_IOC_CHANNEL 9
+#define IEEE80211_IOC_POWERSAVE 10
+#define IEEE80211_IOC_POWERSAVESLEEP 11
+
#endif /* !_NET_IF_IEEE80211_H_ */
diff --git a/sys/net/if_media.c b/sys/net/if_media.c
index 691c8cd..fd372ca 100644
--- a/sys/net/if_media.c
+++ b/sys/net/if_media.c
@@ -401,6 +401,12 @@ struct ifmedia_description ifm_subtype_fddi_descriptions[] =
struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
+struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
+ IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
+
+struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] =
+ IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS;
+
struct ifmedia_description ifm_subtype_shared_descriptions[] =
IFM_SUBTYPE_SHARED_DESCRIPTIONS;
@@ -426,6 +432,10 @@ struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
&ifm_subtype_fddi_descriptions[0],
&ifm_subtype_fddi_option_descriptions[0]
},
+ {
+ &ifm_subtype_ieee80211_descriptions[0],
+ &ifm_subtype_ieee80211_option_descriptions[0]
+ },
};
/*
diff --git a/sys/net/if_media.h b/sys/net/if_media.h
index 2ed5ed0..52bbdbd 100644
--- a/sys/net/if_media.h
+++ b/sys/net/if_media.h
@@ -167,6 +167,19 @@ int ifmedia_ioctl __P((struct ifnet *ifp, struct ifreq *ifr,
#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */
/*
+ * IEEE 802.11 Wireless
+ */
+#define IFM_IEEE80211 0x00000080
+#define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */
+#define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */
+#define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */
+#define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */
+#define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */
+#define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */
+#define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */
+#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */
+
+/*
* Shared media sub-types
*/
#define IFM_AUTO 0 /* Autoselect best media */
@@ -229,9 +242,10 @@ struct ifmedia_description {
};
#define IFM_TYPE_DESCRIPTIONS { \
- { IFM_ETHER, "Ethernet" }, \
- { IFM_TOKEN, "Token ring" }, \
- { IFM_FDDI, "FDDI" }, \
+ { IFM_ETHER, "Ethernet" }, \
+ { IFM_TOKEN, "Token ring" }, \
+ { IFM_FDDI, "FDDI" }, \
+ { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \
{ 0, NULL }, \
}
@@ -330,6 +344,40 @@ struct ifmedia_description {
{ 0, NULL }, \
}
+#define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \
+ { IFM_IEEE80211_FH1, "FH/1Mbps" }, \
+ { IFM_IEEE80211_FH2, "FH/2Mbps" }, \
+ { IFM_IEEE80211_DS1, "DS/1Mbps" }, \
+ { IFM_IEEE80211_DS2, "DS/2Mbps" }, \
+ { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \
+ { IFM_IEEE80211_DS11, "DS/11Mbps" }, \
+ { IFM_IEEE80211_DS22, "DS/22Mbps" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_IEEE80211_ALIASES { \
+ { IFM_IEEE80211_FH1, "FH1" }, \
+ { IFM_IEEE80211_FH2, "FH2" }, \
+ { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \
+ { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \
+ { IFM_IEEE80211_DS1, "DS1" }, \
+ { IFM_IEEE80211_DS2, "DS2" }, \
+ { IFM_IEEE80211_DS5, "DS5.5" }, \
+ { IFM_IEEE80211_DS11, "DS11" }, \
+ { IFM_IEEE80211_DS22, "DS22" }, \
+ { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \
+ { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \
+ { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \
+ { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \
+ { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \
+ { IFM_IEEE80211_ADHOC, "adhoc" }, \
+ { 0, NULL }, \
+}
+
#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
{ IFM_AUTO, "autoselect" }, \
{ IFM_MANUAL, "manual" }, \
OpenPOWER on IntegriCloud