[PATCH 4/6] vlan: Ignore DELLINK on interfaces that exists.

Michael Braun michael-dev
Fri Apr 10 05:49:48 PDT 2015

When hitting
> Failed to create interface wlan3.1: -23 (Too many open files in system)
> Try to remove and re-create wlan3.1
hostapd deletes the AP_VLAN interface and then recreates it. Thus the kernel
assigns the same ifidx to the new interfaces and sends DELLINK and NEWLINK

As the DELLINK messages are processed after the struct hostapd_vlan is added,
hostapd deletes the struct hostapd_vlan entry, deconfigures the AP_VLAN interface
and leaves vlan_newlink nothing to find afterwards.

So this patch makes DELLINK messages to be ignored when the interface exists.

Without this, the test pmksa_cache_preauth_vlan_used fails mostly on second run.

Signed-off-by: Michael Braun <michael-dev at fami-braun.de>
 src/ap/vlan_init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index dc65019..6b55fc9 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -651,6 +651,8 @@ vlan_read_ifnames(struct nlmsghdr *h, size_t len, int del,
 	if (!ifname[0])
+	if (del && if_nametoindex(ifname))
+		return; /* interface still exists, race condition -> iface has just been recreated */
 		   "VLAN: RTM_%sLINK: ifi_index=%d ifname=%s ifi_family=%d ifi_flags=0x%x (%s%s%s%s)",

More information about the Hostap mailing list