[PATCH 4/9] hostapd: verify 160/80+80 driver support

eliad at wizery.com eliad
Thu Oct 17 01:03:41 PDT 2013


From: Eliad Peller <eliad at wizery.com>

Make sure the driver supports 160/80+80 vht capabilities
before trying to configure these channels.

Signed-hostap: Eliad Peller <eliadx.peller at intel.com>
---
 src/ap/ap_drv_ops.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 3072562..e300870 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -469,6 +469,7 @@ int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
 		     int center_segment0, int center_segment1)
 {
 	struct hostapd_freq_params data;
+	u32 vht_caps;
 	int tmp;
 
 	os_memset(&data, 0, sizeof(data));
@@ -482,6 +483,8 @@ int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
 	data.center_freq2 = 0;
 	data.bandwidth = sec_channel_offset ? 40 : 20;
 
+	vht_caps = hapd->iface->current_mode->vht_capab;
+
 	/*
 	 * This validation code is probably misplaced, maybe it should be
 	 * in src/ap/hw_features.c and check the hardware support as well.
@@ -494,6 +497,11 @@ int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
 			return -1;
 		break;
 	case VHT_CHANWIDTH_80P80MHZ:
+		if (!(vht_caps & VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) {
+			wpa_printf(MSG_ERROR,
+				   "80+80 channel width is not supported!");
+			return -1;
+		}
 		if (center_segment1 == center_segment0 + 4 ||
 		    center_segment1 == center_segment0 - 4)
 			return -1;
@@ -517,6 +525,12 @@ int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
 		break;
 	case VHT_CHANWIDTH_160MHZ:
 		data.bandwidth = 160;
+		if (!(vht_caps & (VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
+				  VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ))) {
+			wpa_printf(MSG_ERROR,
+				   "160MHZ channel width is not supported!");
+			return -1;
+		}
 		if (center_segment1)
 			return -1;
 		if (!sec_channel_offset)
-- 
1.7.10.4




More information about the Hostap mailing list