[PATCH] madwifi: implement set_freq for hostapd, adjust hostapd.conf

Pavel Roskin proski
Wed Jul 27 15:03:14 PDT 2011


Signed-off-by: Pavel Roskin <proski at gnu.org>
---
 hostapd/hostapd.conf         |    5 ++---
 src/drivers/driver_madwifi.c |   19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 3b1548c..cad1caf 100644
--- a/hostapd/hostapd.conf
+++ b/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)
diff --git a/src/drivers/driver_madwifi.c b/src/drivers/driver_madwifi.c
index b4abe9c..0a855e7 100644
--- a/src/drivers/driver_madwifi.c
+++ b/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,



More information about the Hostap mailing list