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

Johannes Berg johannes at sipsolutions.net
Tue Nov 27 15:42:14 EST 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.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
---
I'm not 100% sure this is the right thing to do.

 hostapd/driver_devicescape.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

--- hostap.orig/hostapd/driver_devicescape.c	2007-11-27 21:36:52.000000000 +0100
+++ hostap/hostapd/driver_devicescape.c	2007-11-27 21:39:12.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;
 }
 
@@ -1561,7 +1569,7 @@ static int i802_init_sockets(struct i802
 		perror("ioctl[SIOCSIWMODE]");
 	}
 
-	if (hostapd_set_iface_flags(drv, 1))
+	if (hostapd_set_iface_flags(drv, drv->iface, 1))
 		return -1;
 
 	memset(&addr, 0, sizeof(addr));
@@ -1950,7 +1958,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