[PATCH] hostapd: make driver_devicescape set multi-BSS interfaces up

Johannes Berg johannes
Wed Dec 12 08:35:51 PST 2007


It seems that I forgot this when converting the driver to nl80211, it should
of course set IFF_UP on all secondary BSS interfaces as well. I will handle
the MTU issue in a separate patch as this isn't really working right now
anyway. Also note that in another forthcoming patch I will change it to
receive EAPOL frames via the regular data interface. As I've noted before,
this is also necessary for proper MAC address setting in multi-BSS
scenarios.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
---
 hostapd/driver_devicescape.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

--- hostap.orig/hostapd/driver_devicescape.c	2007-12-12 17:28:55.000000000 +0100
+++ hostap/hostapd/driver_devicescape.c	2007-12-12 17:29:00.000000000 +0100
@@ -77,7 +77,8 @@ static int i802_sta_set_flags(void *priv
 			      int total_flags, int flags_or, int flags_and);
 
 
-static int hostapd_set_iface_flags(struct i802_driver_data *drv, int dev_up)
+static int hostapd_set_iface_flags(struct i802_driver_data *drv,
+				   const char *ifname, int dev_up)
 {
 	struct ifreq ifr;
 
@@ -85,7 +86,7 @@ static int hostapd_set_iface_flags(struc
 		return -1;
 
 	memset(&ifr, 0, sizeof(ifr));
-	os_strlcpy(ifr.ifr_name, drv->iface, IFNAMSIZ);
+	os_strlcpy(ifr.ifr_name, ifname, IFNAMSIZ);
 
 	if (ioctl(drv->ioctl_sock, SIOCGIFFLAGS, &ifr) != 0) {
 		perror("ioctl[SIOCGIFFLAGS]");
@@ -854,8 +855,15 @@ static int nl80211_create_iface(struct i
 
 static int i802_bss_add(void *priv, const char *ifname, const u8 *bssid)
 {
-	if (nl80211_create_iface(priv, ifname, NL80211_IFTYPE_AP, bssid) < 0)
+	int ifidx;
+
+	ifidx = nl80211_create_iface(priv, ifname, NL80211_IFTYPE_AP, bssid);
+	if (ifidx < 0)
 		return -1;
+	if (hostapd_set_iface_flags(priv, ifname, 1)) {
+		nl80211_remove_iface(priv, ifidx);
+		return -1;
+	}
 	return 0;
 }
 
@@ -1563,7 +1571,7 @@ static int i802_init_sockets(struct i802
 		return -1;
 	}
 
-	if (hostapd_set_iface_flags(drv, 1))
+	if (hostapd_set_iface_flags(drv, drv->iface, 1))
 		return -1;
 
 	memset(&addr, 0, sizeof(addr));
@@ -1952,7 +1960,7 @@ static void i802_deinit(void *priv)
 	/* Disable management interface */
 	(void) hostap_ioctl_prism2param(drv, PRISM2_PARAM_MGMT_IF, 0);
 
-	(void) hostapd_set_iface_flags(drv, 0);
+	(void) hostapd_set_iface_flags(drv, drv->iface, 0);
 
 	if (drv->sock >= 0) {
 		eloop_unregister_read_sock(drv->sock);






More information about the Hostap mailing list