From patchwork Fri May 17 07:30:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: michael-dev X-Patchwork-Id: 249360 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 8F9982C0096 for ; Thu, 6 Jun 2013 20:10:23 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 985A89D200; Thu, 6 Jun 2013 06:10:18 -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 1UCnnbMkNdmP; Thu, 6 Jun 2013 06:10:18 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 587E39C15B; Thu, 6 Jun 2013 06:09:16 -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 ACDAE9C0F8 for ; Thu, 6 Jun 2013 06:09:12 -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 s2VEYu7nrMvx for ; Thu, 6 Jun 2013 06:09:07 -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 6AC769C0F6 for ; Thu, 6 Jun 2013 06:09:07 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.fem.tu-ilmenau.de (Postfix) with ESMTP id CF86864B7 for ; Thu, 6 Jun 2013 12:09:06 +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 3fNe17GXvQmY; Thu, 6 Jun 2013 12:09:06 +0200 (CEST) Received: from a234.fem.tu-ilmenau.de (unknown [10.42.51.234]) by mail.fem.tu-ilmenau.de (Postfix) with ESMTP; Thu, 6 Jun 2013 12:09:06 +0200 (CEST) Received: by a234.fem.tu-ilmenau.de (Postfix, from userid 0) id 3781E20A666; Thu, 6 Jun 2013 12:09:06 +0200 (CEST) Message-Id: In-Reply-To: References: From: Michael Braun Date: Fri, 17 May 2013 09:30:13 +0200 Subject: [PATCHv2 01/21] bridge: give bridge name in per-bss configuration To: hostap@lists.shmoo.com 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 Reply-To: projekt-wlan@fem.tu-ilmenau.de 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 Currently, when different BSS using different tagged vlan interfaces, they are forced to share the bridge brvlan#, which is not desirable. This patch fixes this by making the bridge name configurable. Signed-hostap: Michael Braun diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 231b0f9..cd9c7ca 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -1689,6 +1689,9 @@ static int hostapd_config_fill(struct hostapd_config *conf, sizeof(conf->bss[0].iface)); } else if (os_strcmp(buf, "bridge") == 0) { os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); + } else if (os_strcmp(buf, "vlan_bridge") == 0) { + os_strlcpy(bss->vlan_bridge, pos, + sizeof(bss->vlan_bridge)); } else if (os_strcmp(buf, "wds_bridge") == 0) { os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge)); diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index be15b86..d9f4c9d 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -844,6 +844,10 @@ own_ip_addr=127.0.0.1 # to the bridge. #vlan_tagged_interface=eth0 +# Bridge (Prefix) to add the wifi and the tagged interface to. This gets the +# VLAN ID appended. +#vlan_bridge=brvlan + # When hostapd creates a VLAN interface on vlan_tagged_interfaces, it needs # to know how to name it. # 0 = vlan, e.g., vlan1 diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 7c9ea90..5cb951f 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -180,6 +180,7 @@ struct hostapd_nai_realm_data { struct hostapd_bss_config { char iface[IFNAMSIZ + 1]; char bridge[IFNAMSIZ + 1]; + char vlan_bridge[IFNAMSIZ + 1]; char wds_bridge[IFNAMSIZ + 1]; enum hostapd_logger_level logger_syslog_level, logger_stdout_level; diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c index 6390e8b..e9ebcdd 100644 --- a/src/ap/vlan_init.c +++ b/src/ap/vlan_init.c @@ -493,8 +493,14 @@ static void vlan_newlink(char *ifname, struct hostapd_data *hapd) while (vlan) { if (os_strcmp(ifname, vlan->ifname) == 0) { - os_snprintf(br_name, sizeof(br_name), "brvlan%d", - vlan->vlan_id); + if (hapd->conf->vlan_bridge[0]) { + os_snprintf(br_name, sizeof(br_name), "%s%d", + hapd->conf->vlan_bridge, + vlan->vlan_id); + } else { + os_snprintf(br_name, sizeof(br_name), + "brvlan%d", vlan->vlan_id); + } if (!br_addbr(br_name)) vlan->clean |= DVLAN_CLEAN_BR; @@ -550,8 +556,14 @@ static void vlan_dellink(char *ifname, struct hostapd_data *hapd) while (vlan) { if (os_strcmp(ifname, vlan->ifname) == 0) { - os_snprintf(br_name, sizeof(br_name), "brvlan%d", - vlan->vlan_id); + if (hapd->conf->vlan_bridge[0]) { + os_snprintf(br_name, sizeof(br_name), "%s%d", + hapd->conf->vlan_bridge, + vlan->vlan_id); + } else { + os_snprintf(br_name, sizeof(br_name), + "brvlan%d", vlan->vlan_id); + } if (vlan->clean & DVLAN_CLEAN_WLAN_PORT) br_delif(br_name, vlan->ifname);