]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Fill in phyname automatically
authorJouni Malinen <j@w1.fi>
Sun, 3 Nov 2013 16:20:28 +0000 (18:20 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 3 Nov 2013 17:51:06 +0000 (19:51 +0200)
If per-BSS configuration enabling did not provide a phy name, iface->phy
was left empty. It can be helpful to set this up automatically, so fill
that when initializing the interface.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/ap/ap_drv_ops.h
src/ap/hostapd.c

index 024339ab8482c37df5cb9b0fe1afaf8581bfe451..68d3efabab39e259e0aea00f52a4315a93944ceb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * hostapd - Driver operations
- * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2009-2013, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -249,4 +249,12 @@ static inline int hostapd_get_country(struct hostapd_data *hapd, char *alpha2)
        return hapd->driver->get_country(hapd->drv_priv, alpha2);
 }
 
+static inline const char * hostapd_drv_get_radio_name(struct hostapd_data *hapd)
+{
+       if (hapd->driver == NULL || hapd->drv_priv == NULL ||
+           hapd->driver->get_radio_name == NULL)
+               return NULL;
+       return hapd->driver->get_radio_name(hapd->drv_priv);
+}
+
 #endif /* AP_DRV_OPS */
index 3483b6486ba3ef70ea64f1067866e35013b5f7d3..673c8140e98f8f6e1634e3a4227282eb4f1c0382 100644 (file)
@@ -965,6 +965,14 @@ static int setup_interface(struct hostapd_iface *iface)
        struct hostapd_data *hapd = iface->bss[0];
        size_t i;
 
+       if (!iface->phy[0]) {
+               const char *phy = hostapd_drv_get_radio_name(hapd);
+               if (phy) {
+                       wpa_printf(MSG_DEBUG, "phy: %s", phy);
+                       os_strlcpy(iface->phy, phy, sizeof(iface->phy));
+               }
+       }
+
        /*
         * Make sure that all BSSes get configured with a pointer to the same
         * driver interface.