Browse Source

Added option to distinguish non-HT and HT20 in set_freq

Jouni Malinen 16 years ago
parent
commit
fe0f58fa69
3 changed files with 8 additions and 1 deletions
  1. 3 1
      hostapd/driver.h
  2. 4 0
      hostapd/driver_nl80211.c
  3. 1 0
      hostapd/hostapd.c

+ 3 - 1
hostapd/driver.h

@@ -30,6 +30,7 @@ struct hostapd_sta_add_params {
 struct hostapd_freq_params {
 	int mode;
 	int freq;
+	int ht_enabled;
 	int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
 				 * secondary channel below primary, 1 = HT40
 				 * enabled, secondary channel above primary */
@@ -431,7 +432,7 @@ hostapd_get_inact_sec(struct hostapd_data *hapd, const u8 *addr)
 }
 
 static inline int
-hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
+hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int ht_enabled,
 		 int sec_channel_offset)
 {
 	if (hapd->driver == NULL)
@@ -441,6 +442,7 @@ hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
 		os_memset(&data, 0, sizeof(data));
 		data.mode = mode;
 		data.freq = freq;
+		data.ht_enabled = ht_enabled;
 		data.sec_channel_offset = sec_channel_offset;
 		return hapd->driver->set_freq2(hapd->drv_priv, &data);
 	}

+ 4 - 0
hostapd/driver_nl80211.c

@@ -485,6 +485,10 @@ static int i802_set_freq2(void *priv, struct hostapd_freq_params *freq)
 		NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET,
 			   NL80211_SEC_CHAN_ABOVE);
 		break;
+	default:
+		NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET,
+			   NL80211_SEC_CHAN_DISABLED);
+		break;
 	}
 
 	if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0)

+ 1 - 0
hostapd/hostapd.c

@@ -1554,6 +1554,7 @@ static int setup_interface(struct hostapd_iface *iface)
 		       hapd->iconf->channel, freq);
 
 		if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, freq,
+				     hapd->iconf->ieee80211n,
 				     hapd->iconf->secondary_channel)) {
 			printf("Could not set channel for kernel driver\n");
 			return -1;