From patchwork Sat Jul 27 16:18:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: michael-dev X-Patchwork-Id: 262482 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8E2F52C008F for ; Sun, 28 Jul 2013 02:19:18 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A343B17C14B; Sat, 27 Jul 2013 12:19:16 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h0VkITb0iVCO; Sat, 27 Jul 2013 12:19:16 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 32FC317C14C; Sat, 27 Jul 2013 12:18:44 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B491417C14B for ; Sat, 27 Jul 2013 12:18:42 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zensRpFmMEQk for ; Sat, 27 Jul 2013 12:18:37 -0400 (EDT) Received: from mail.fem.tu-ilmenau.de (mail.fem.tu-ilmenau.de [141.24.101.79]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2A82217C14C for ; Sat, 27 Jul 2013 12:18:17 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.fem.tu-ilmenau.de (Postfix) with ESMTP id B1A30656D for ; Sat, 27 Jul 2013 18:18:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at fem.tu-ilmenau.de Received: from mail.fem.tu-ilmenau.de ([127.0.0.1]) by localhost (mail.fem.tu-ilmenau.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Rh5ND93v6ibP; Sat, 27 Jul 2013 18:18:16 +0200 (CEST) Received: from a234.fem.tu-ilmenau.de (unknown [10.42.51.234]) by mail.fem.tu-ilmenau.de (Postfix) with ESMTP; Sat, 27 Jul 2013 18:18:16 +0200 (CEST) Received: from [10.42.51.234] (localhost [127.0.0.1]) by a234.fem.tu-ilmenau.de (Postfix) with ESMTP id 3F374BD0; Sat, 27 Jul 2013 18:18:16 +0200 (CEST) Subject: [PATCH v3 20/25] Fix kernel NEWLINK processing To: hostap@lists.shmoo.com From: Michael Braun Date: Sat, 27 Jul 2013 18:18:16 +0200 Message-ID: <20130727161815.1152.98321.stgit@ray-controller> In-Reply-To: <20130727160024.1152.46147.stgit@ray-controller> References: <20130727160024.1152.46147.stgit@ray-controller> User-Agent: StGit/0.16 MIME-Version: 1.0 Cc: projekt-wlan@fem.tu-ilmenau.de X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Somehow with Kernel 3.8.11 and others, there are multiple NEWLINK messages received all containing wlanX.. 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 --- 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 5c5b15a..deae005 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -88,6 +88,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.. + * 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 12fc2a1..8e4668c 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) &&