Browse Source

nl80211: Add bridge interfaces from secondary BSSes to ifidx list

This fixes EAPOL RX for secondary BSSes that are in a bridge that does
not match with the bridge used for the primary BSS.
Jouni Malinen 16 years ago
parent
commit
acae30ed7b
1 changed files with 8 additions and 5 deletions
  1. 8 5
      hostapd/driver_nl80211.c

+ 8 - 5
hostapd/driver_nl80211.c

@@ -65,7 +65,6 @@ struct i802_driver_data {
 	struct hostapd_data *hapd;
 	struct hostapd_data *hapd;
 
 
 	char iface[IFNAMSIZ + 1];
 	char iface[IFNAMSIZ + 1];
-	int bridge;
 	int ioctl_sock; /* socket for ioctl() use */
 	int ioctl_sock; /* socket for ioctl() use */
 	int wext_sock; /* socket for wireless events */
 	int wext_sock; /* socket for wireless events */
 	int eapol_sock; /* socket for EAPOL frames */
 	int eapol_sock; /* socket for EAPOL frames */
@@ -115,6 +114,8 @@ static void add_ifidx(struct i802_driver_data *drv, int ifidx)
 	int i;
 	int i;
 	int *old;
 	int *old;
 
 
+	wpa_printf(MSG_DEBUG, "nl80211: Add own interface ifindex %d",
+		   ifidx);
 	for (i = 0; i < drv->num_if_indices; i++) {
 	for (i = 0; i < drv->num_if_indices; i++) {
 		if (drv->if_indices[i] == 0) {
 		if (drv->if_indices[i] == 0) {
 			drv->if_indices[i] = ifidx;
 			drv->if_indices[i] = ifidx;
@@ -161,9 +162,6 @@ static int have_ifidx(struct i802_driver_data *drv, int ifidx)
 {
 {
 	int i;
 	int i;
 
 
-	if (ifidx == drv->bridge)
-		return 1;
-
 	for (i = 0; i < drv->num_if_indices; i++)
 	for (i = 0; i < drv->num_if_indices; i++)
 		if (drv->if_indices[i] == ifidx)
 		if (drv->if_indices[i] == ifidx)
 			return 1;
 			return 1;
@@ -2874,6 +2872,7 @@ i802_get_neighbor_bss(void *priv, size_t *num)
 static void *i802_init_bssid(struct hostapd_data *hapd, const u8 *bssid)
 static void *i802_init_bssid(struct hostapd_data *hapd, const u8 *bssid)
 {
 {
 	struct i802_driver_data *drv;
 	struct i802_driver_data *drv;
+	size_t i;
 
 
 	drv = os_zalloc(sizeof(struct i802_driver_data));
 	drv = os_zalloc(sizeof(struct i802_driver_data));
 	if (drv == NULL) {
 	if (drv == NULL) {
@@ -2887,7 +2886,11 @@ static void *i802_init_bssid(struct hostapd_data *hapd, const u8 *bssid)
 
 
 	drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int);
 	drv->num_if_indices = sizeof(drv->default_if_indices) / sizeof(int);
 	drv->if_indices = drv->default_if_indices;
 	drv->if_indices = drv->default_if_indices;
-	drv->bridge = if_nametoindex(hapd->conf->bridge);
+	for (i = 0; i < hapd->iface->num_bss; i++) {
+		struct hostapd_data *bss = hapd->iface->bss[i];
+		if (bss->conf->bridge)
+			add_ifidx(drv, if_nametoindex(bss->conf->bridge));
+	}
 	drv->ht_40mhz_scan = hapd->iconf->secondary_channel != 0;
 	drv->ht_40mhz_scan = hapd->iconf->secondary_channel != 0;
 
 
 	if (i802_init_sockets(drv, bssid))
 	if (i802_init_sockets(drv, bssid))