[PATCH v5 18/22] Fix kernel NEWLINK processing
Michael Braun
michael-dev
Tue Nov 19 11:48:10 PST 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>
---
src/ap/ap_config.h | 7 +++++++
src/ap/vlan_init.c | 9 ++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 4018bb4..f51b6a8 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -90,6 +90,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 8c09896..8b8849b 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -662,7 +662,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;
@@ -696,6 +696,9 @@ static void vlan_newlink(char *ifname, struct hostapd_data *hapd)
vlan_newlink_vlan(tagged_vlan_id, vlan_ifname, clean,
hapd);
}
+
+ vlan->newlink_seen = 1;
+
break;
}
}
@@ -739,6 +742,10 @@ static void vlan_dellink_vlan(int vlan_id, char* ifname, int *clean,
ifconfig_down(vlan_ifname);
vlan_rem(vlan_ifname);
}
+
+ /* newlink_seen does not need to be reset, as the whole
+ * vlan entry is freed uplink RTM_DELLINK
+ */
}
if (clean && (*clean & DVLAN_CLEAN_BR) &&
More information about the Hostap
mailing list