[PATCHv2 15/21] Fix kernel NEWLINK processing

Michael Braun michael-dev
Sun Jun 2 02:17:20 PDT 2013


Somehow with Kernel 3.8.11 and others, there are multiple NEWLINK
messages received all containing wlanX.<VLAN>.
Though, when processing the extra NEWLINK messages, the usage counters
get increased too far so the dynamic interfaces get not freed.

Signed-hostap: Michael Braun <michael-dev at fami-braun.de>

diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 9638d0e..504e8f3 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -96,6 +96,13 @@ struct hostapd_vlan {
 	 * generation. The linked list is sorted by this id (ascending);
 	 * non-dynamically generated entries get value zero */
 	int artifical_id;
+	/* Somehow with Kernel 3.8.11 and others, there are multiple NEWLINK
+	 * messages received all containing wlanX.<VLAN>.
+	 * Though, when processing the extra NEWLINK messages, the usage
+	 * counters get increased too far so the dynamic interfaces get not
+	 * freed.
+	 */
+	int newlink_seen;
 	int dynamic_vlan;
 #ifdef CONFIG_FULL_DYNAMIC_VLAN
 
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index 20c9ff9..982e793 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -658,7 +658,7 @@ static void vlan_newlink(char *ifname, struct hostapd_data *hapd)
 	wpa_printf(MSG_DEBUG, "VLAN: vlan_newlink(%s)", ifname);
 
 	for (vlan = hapd->conf->vlan; vlan; vlan = vlan->next) {
-		if (os_strcmp(ifname, vlan->ifname) != 0)
+		if (os_strcmp(ifname, vlan->ifname) != 0 || vlan->newlink_seen)
 			continue;
 
 		int untagged, num_tagged, *tagged;
@@ -692,6 +692,11 @@ static void vlan_newlink(char *ifname, struct hostapd_data *hapd)
 			vlan_newlink_vlan(tagged_vlan_id, vlan_ifname, clean,
 			                  hapd);
 		}
+
+		/* newlink_seen does not need to be reset, as the whole
+		 * vlan entry is freed uplink RTM_DELLINK
+		 */
+		vlan->newlink_seen = 1;
 		break;
 	}
 }



More information about the Hostap mailing list