Browse Source

madwifi: Implement set_freq for hostapd, adjust hostapd.conf

Signed-off-by: Pavel Roskin <proski@gnu.org>
Pavel Roskin 13 years ago
parent
commit
e783c9b0e5
2 changed files with 21 additions and 3 deletions
  1. 2 3
      hostapd/hostapd.conf
  2. 19 0
      src/drivers/driver_madwifi.c

+ 2 - 3
hostapd/hostapd.conf

@@ -103,9 +103,8 @@ hw_mode=a
 
 # Channel number (IEEE 802.11)
 # (default: 0, i.e., not set)
-# Please note that some drivers (e.g., madwifi) do not use this value from
-# hostapd and the channel will need to be configuration separately with
-# iwconfig.
+# Please note that some drivers do not use this value from hostapd and the
+# channel will need to be configured separately with iwconfig.
 channel=60
 
 # Beacon interval in kus (1.024 ms) (default: 100; range 15..65535)

+ 19 - 0
src/drivers/driver_madwifi.c

@@ -806,6 +806,24 @@ madwifi_set_ap_wps_ie(void *priv, const struct wpabuf *beacon,
 #define madwifi_set_ap_wps_ie NULL
 #endif /* CONFIG_WPS */
 
+static int madwifi_set_freq(void *priv, struct hostapd_freq_params *freq)
+{
+	struct madwifi_driver_data *drv = priv;
+	struct iwreq iwr;
+
+	os_memset(&iwr, 0, sizeof(iwr));
+	os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
+	iwr.u.freq.m = freq->channel;
+	iwr.u.freq.e = 0;
+
+	if (ioctl(drv->ioctl_sock, SIOCSIWFREQ, &iwr) < 0) {
+		perror("ioctl[SIOCSIWFREQ]");
+		return -1;
+	}
+
+	return 0;
+}
+
 static void
 madwifi_new_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
 {
@@ -1842,6 +1860,7 @@ const struct wpa_driver_ops wpa_driver_madwifi_ops = {
 	.sta_clear_stats        = madwifi_sta_clear_stats,
 	.commit			= madwifi_commit,
 	.set_ap_wps_ie		= madwifi_set_ap_wps_ie,
+	.set_freq		= madwifi_set_freq,
 #else /* HOSTAPD */
 	.get_bssid		= wpa_driver_madwifi_get_bssid,
 	.get_ssid		= wpa_driver_madwifi_get_ssid,