Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F112562862
D42901.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D42901.diff
View Options
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -70,6 +70,7 @@
#include <net/if_media.h>
#include <net/route.h>
+#define WANT_NET80211 1
#include <net80211/ieee80211_ioctl.h>
#include <net80211/ieee80211_freebsd.h>
#include <net80211/ieee80211_superg.h>
@@ -2780,10 +2781,18 @@
{
printf("%s", tag);
if (ctx->args->verbose) {
- const struct ieee80211_ie_vhtcap *vhtcap =
- (const struct ieee80211_ie_vhtcap *) ie;
- uint32_t vhtcap_info = LE_READ_4(&vhtcap->vht_cap_info);
+ const struct ieee80211_vht_cap *vhtcap;
+ uint32_t vhtcap_info;
+ /* Check that the the right size. */
+ if (ie[1] != sizeof(*vhtcap)) {
+ printf("<err: vht_cap inval. length>");
+ return;
+ }
+ /* Skip Element ID and Length. */
+ vhtcap = (const struct ieee80211_vht_cap *)(ie + 2);
+
+ vhtcap_info = LE_READ_4(&vhtcap->vht_cap_info);
printf("<cap 0x%08x", vhtcap_info);
printf(" rx_mcs_map 0x%x",
LE_READ_2(&vhtcap->supp_mcs.rx_mcs_map));
@@ -2803,13 +2812,20 @@
{
printf("%s", tag);
if (ctx->args->verbose) {
- const struct ieee80211_ie_vht_operation *vhtinfo =
- (const struct ieee80211_ie_vht_operation *) ie;
+ const struct ieee80211_vht_operation *vhtinfo;
+
+ /* Check that the the right size. */
+ if (ie[1] != sizeof(*vhtinfo)) {
+ printf("<err: vht_operation inval. length>");
+ return;
+ }
+ /* Skip Element ID and Length. */
+ vhtinfo = (const struct ieee80211_vht_operation *)(ie + 2);
- printf("<chw %d freq1_idx %d freq2_idx %d basic_mcs_set 0x%04x>",
+ printf("<chw %d freq0_idx %d freq1_idx %d basic_mcs_set 0x%04x>",
vhtinfo->chan_width,
- vhtinfo->center_freq_seg1_idx,
- vhtinfo->center_freq_seg2_idx,
+ vhtinfo->center_freq_seq0_idx,
+ vhtinfo->center_freq_seq1_idx,
LE_READ_2(&vhtinfo->basic_mcs_set));
}
}
diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h
--- a/sys/net80211/ieee80211.h
+++ b/sys/net80211/ieee80211.h
@@ -869,29 +869,25 @@
struct ieee80211_vht_mcs_info supp_mcs;
} __packed;
-/* VHT capabilities element: 802.11ac-2013 8.4.2.160 */
-struct ieee80211_ie_vhtcap {
- uint8_t ie;
- uint8_t len;
- uint32_t vht_cap_info;
- struct ieee80211_vht_mcs_info supp_mcs;
-} __packed;
-
-/* VHT operation mode subfields - 802.11ac-2013 Table 8.183x */
-#define IEEE80211_VHT_CHANWIDTH_USE_HT 0 /* Use HT IE for chw */
-#define IEEE80211_VHT_CHANWIDTH_80MHZ 1 /* 80MHz */
-#define IEEE80211_VHT_CHANWIDTH_160MHZ 2 /* 160MHz */
-#define IEEE80211_VHT_CHANWIDTH_80P80MHZ 3 /* 80+80MHz */
+/* 802.11ac-2013, Table 8-183x-VHT Operation Information subfields */
+enum ieee80211_vht_chanwidth {
+ IEEE80211_VHT_CHANWIDTH_USE_HT = 0, /* 20 MHz or 40 MHz */
+ IEEE80211_VHT_CHANWIDTH_80MHZ = 1, /* 80MHz */
+ IEEE80211_VHT_CHANWIDTH_160MHZ = 2, /* 160MHz */
+ IEEE80211_VHT_CHANWIDTH_80P80MHZ = 3, /* 80+80MHz */
+ /* 4..255 reserved. */
+};
-/* VHT operation IE - 802.11ac-2013 8.4.2.161 */
-struct ieee80211_ie_vht_operation {
- uint8_t ie;
- uint8_t len;
- uint8_t chan_width;
- uint8_t center_freq_seg1_idx;
- uint8_t center_freq_seg2_idx;
- uint16_t basic_mcs_set;
+/* The name conflicts with the same structure in wpa. Only ifconfig needs this. */
+#if defined(_KERNEL) || defined(WANT_NET80211)
+/* 802.11ac-2013 8.4.2.161 VHT Operation element */
+struct ieee80211_vht_operation {
+ uint8_t chan_width; /* enum ieee80211_vht_chanwidth */
+ uint8_t center_freq_seq0_idx; /* 20/40/80/160 - VHT chan1 */
+ uint8_t center_freq_seq1_idx; /* 80+80 - VHT chan2 */
+ uint16_t basic_mcs_set; /* Basic VHT-MCS and NSS Set */
} __packed;
+#endif
/* 802.11ac VHT Capabilities */
#define IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 0x00000000
diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c
--- a/sys/net80211/ieee80211_hostap.c
+++ b/sys/net80211/ieee80211_hostap.c
@@ -2125,12 +2125,12 @@
/* Validate VHT IEs */
if (vhtcap != NULL) {
IEEE80211_VERIFY_LENGTH(vhtcap[1],
- sizeof(struct ieee80211_ie_vhtcap) - 2,
+ sizeof(struct ieee80211_vht_cap),
return);
}
if (vhtinfo != NULL) {
IEEE80211_VERIFY_LENGTH(vhtinfo[1],
- sizeof(struct ieee80211_ie_vht_operation) - 2,
+ sizeof(struct ieee80211_vht_operation),
return);
}
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -773,12 +773,12 @@
/* Process VHT IEs */
if (scan->vhtcap != NULL) {
IEEE80211_VERIFY_LENGTH(scan->vhtcap[1],
- sizeof(struct ieee80211_ie_vhtcap) - 2,
+ sizeof(struct ieee80211_vht_cap),
scan->vhtcap = NULL);
}
if (scan->vhtopmode != NULL) {
IEEE80211_VERIFY_LENGTH(scan->vhtopmode[1],
- sizeof(struct ieee80211_ie_vht_operation) - 2,
+ sizeof(struct ieee80211_vht_operation),
scan->vhtopmode = NULL);
}
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -2456,7 +2456,7 @@
sizeof(struct ieee80211_ie_htcap) : 0)
#ifdef notyet
+ sizeof(struct ieee80211_ie_htinfo) /* XXX not needed? */
- + sizeof(struct ieee80211_ie_vhtcap)
+ + 2 + sizeof(struct ieee80211_vht_cap)
#endif
+ ((vap->iv_flags & IEEE80211_F_WPA1 && vap->iv_wpa_ie != NULL) ?
vap->iv_wpa_ie[1] : 0)
@@ -2821,7 +2821,7 @@
+ 2 + 26
+ sizeof(struct ieee80211_wme_info)
+ sizeof(struct ieee80211_ie_htcap)
- + sizeof(struct ieee80211_ie_vhtcap)
+ + 2 + sizeof(struct ieee80211_vht_cap)
+ 4 + sizeof(struct ieee80211_ie_htcap)
#ifdef IEEE80211_SUPPORT_SUPERG
+ sizeof(struct ieee80211_ath_ie)
@@ -2954,8 +2954,8 @@
+ 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE)
+ sizeof(struct ieee80211_ie_htcap) + 4
+ sizeof(struct ieee80211_ie_htinfo) + 4
- + sizeof(struct ieee80211_ie_vhtcap)
- + sizeof(struct ieee80211_ie_vht_operation)
+ + 2 + sizeof(struct ieee80211_vht_cap)
+ + 2 + sizeof(struct ieee80211_vht_operation)
+ sizeof(struct ieee80211_wme_param)
#ifdef IEEE80211_SUPPORT_SUPERG
+ sizeof(struct ieee80211_ath_ie)
@@ -3113,8 +3113,8 @@
+ sizeof(struct ieee80211_wme_param)
+ 4 + sizeof(struct ieee80211_ie_htcap)
+ 4 + sizeof(struct ieee80211_ie_htinfo)
- + sizeof(struct ieee80211_ie_vhtcap)
- + sizeof(struct ieee80211_ie_vht_operation)
+ + 2 + sizeof(struct ieee80211_vht_cap)
+ + 2 + sizeof(struct ieee80211_vht_operation)
#ifdef IEEE80211_SUPPORT_SUPERG
+ sizeof(struct ieee80211_ath_ie)
#endif
@@ -3728,8 +3728,8 @@
/* XXX conditional? */
+ 4+2*sizeof(struct ieee80211_ie_htcap)/* HT caps */
+ 4+2*sizeof(struct ieee80211_ie_htinfo)/* HT info */
- + sizeof(struct ieee80211_ie_vhtcap)/* VHT caps */
- + sizeof(struct ieee80211_ie_vht_operation)/* VHT info */
+ + 2 + sizeof(struct ieee80211_vht_cap)/* VHT caps */
+ + 2 + sizeof(struct ieee80211_vht_operation)/* VHT info */
+ (vap->iv_caps & IEEE80211_C_WME ? /* WME */
sizeof(struct ieee80211_wme_param) : 0)
#ifdef IEEE80211_SUPPORT_SUPERG
diff --git a/sys/net80211/ieee80211_vht.h b/sys/net80211/ieee80211_vht.h
--- a/sys/net80211/ieee80211_vht.h
+++ b/sys/net80211/ieee80211_vht.h
@@ -61,8 +61,8 @@
struct ieee80211_channel *, int);
void ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni,
- struct ieee80211_ie_vhtcap *, int);
+ struct ieee80211_vht_cap *, int);
void ieee80211_vht_get_vhtinfo_ie(struct ieee80211_node *ni,
- struct ieee80211_ie_vht_operation *, int);
+ struct ieee80211_vht_operation *, int);
#endif /* _NET80211_IEEE80211_VHT_H_ */
diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c
--- a/sys/net80211/ieee80211_vht.c
+++ b/sys/net80211/ieee80211_vht.c
@@ -338,7 +338,7 @@
*/
void
ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni,
- struct ieee80211_ie_vhtcap *vhtcap, int opmode)
+ struct ieee80211_vht_cap *vhtcap, int opmode)
{
struct ieee80211vap *vap = ni->ni_vap;
// struct ieee80211com *ic = vap->iv_ic;
@@ -346,9 +346,6 @@
uint32_t new_vhtcap;
int i;
- vhtcap->ie = IEEE80211_ELEMID_VHT_CAP;
- vhtcap->len = sizeof(struct ieee80211_ie_vhtcap) - 2;
-
/*
* Capabilities - it depends on whether we are a station
* or not.
@@ -676,19 +673,12 @@
uint8_t *
ieee80211_add_vhtcap(uint8_t *frm, struct ieee80211_node *ni)
{
- struct ieee80211_ie_vhtcap vhtcap;
- int opmode;
-
- opmode = 0;
- if (ni->ni_vap->iv_opmode == IEEE80211_M_STA)
- opmode = 1;
-
- ieee80211_vht_get_vhtcap_ie(ni, &vhtcap, opmode);
+ struct ieee80211_vht_cap vhtcap;
- memset(frm, '\0', sizeof(struct ieee80211_ie_vhtcap));
+ ieee80211_vht_get_vhtcap_ie(ni, &vhtcap, 1);
frm[0] = IEEE80211_ELEMID_VHT_CAP;
- frm[1] = sizeof(struct ieee80211_ie_vhtcap) - 2;
+ frm[1] = sizeof(vhtcap);
frm += 2;
/* 32-bit VHT capability */
@@ -771,10 +761,9 @@
uint8_t *
ieee80211_add_vhtinfo(uint8_t *frm, struct ieee80211_node *ni)
{
- memset(frm, '\0', sizeof(struct ieee80211_ie_vht_operation));
frm[0] = IEEE80211_ELEMID_VHT_OPMODE;
- frm[1] = sizeof(struct ieee80211_ie_vht_operation) - 2;
+ frm[1] = sizeof(struct ieee80211_vht_operation);
frm += 2;
/* 8-bit chanwidth */
@@ -882,7 +871,7 @@
*/
void
ieee80211_vht_get_vhtinfo_ie(struct ieee80211_node *ni,
- struct ieee80211_ie_vht_operation *vhtop, int opmode)
+ struct ieee80211_vht_operation *vhtop, int opmode)
{
printf("%s: called; TODO!\n", __func__);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 9:18 PM (18 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17234869
Default Alt Text
D42901.diff (9 KB)
Attached To
Mode
D42901: net80211: adjust more VHT structures/fields
Attached
Detach File
Event Timeline
Log In to Comment