Browse Source

Make channel number available to set_freq()

Since we have the channel number, we could as well pass it to the driver
wrapper should there be drivers that use channel number instead of
frequency.
Jouni Malinen 16 years ago
parent
commit
9c6d8e1db5
3 changed files with 5 additions and 2 deletions
  1. 1 0
      hostapd/driver.h
  2. 3 2
      hostapd/driver_i.h
  3. 1 0
      hostapd/hostapd.c

+ 1 - 0
hostapd/driver.h

@@ -47,6 +47,7 @@ struct hostapd_sta_add_params {
 struct hostapd_freq_params {
 struct hostapd_freq_params {
 	int mode;
 	int mode;
 	int freq;
 	int freq;
+	int channel;
 	int ht_enabled;
 	int ht_enabled;
 	int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
 	int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
 				 * secondary channel below primary, 1 = HT40
 				 * secondary channel below primary, 1 = HT40

+ 3 - 2
hostapd/driver_i.h

@@ -242,8 +242,8 @@ hostapd_get_inact_sec(struct hostapd_data *hapd, const u8 *addr)
 }
 }
 
 
 static inline int
 static inline int
-hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int ht_enabled,
-		 int sec_channel_offset)
+hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int channel,
+		 int ht_enabled, int sec_channel_offset)
 {
 {
 	struct hostapd_freq_params data;
 	struct hostapd_freq_params data;
 	if (hapd->driver == NULL)
 	if (hapd->driver == NULL)
@@ -253,6 +253,7 @@ hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int ht_enabled,
 	os_memset(&data, 0, sizeof(data));
 	os_memset(&data, 0, sizeof(data));
 	data.mode = mode;
 	data.mode = mode;
 	data.freq = freq;
 	data.freq = freq;
+	data.channel = channel;
 	data.ht_enabled = ht_enabled;
 	data.ht_enabled = ht_enabled;
 	data.sec_channel_offset = sec_channel_offset;
 	data.sec_channel_offset = sec_channel_offset;
 	return hapd->driver->set_freq(hapd->drv_priv, &data);
 	return hapd->driver->set_freq(hapd->drv_priv, &data);

+ 1 - 0
hostapd/hostapd.c

@@ -1391,6 +1391,7 @@ static int setup_interface(struct hostapd_iface *iface)
 			   hapd->iconf->channel, freq);
 			   hapd->iconf->channel, freq);
 
 
 		if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, freq,
 		if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, freq,
+				     hapd->iconf->channel,
 				     hapd->iconf->ieee80211n,
 				     hapd->iconf->ieee80211n,
 				     hapd->iconf->secondary_channel)) {
 				     hapd->iconf->secondary_channel)) {
 			wpa_printf(MSG_ERROR, "Could not set channel for "
 			wpa_printf(MSG_ERROR, "Could not set channel for "