Message ID | 358aa5e3c2eef6e77c9062a965486a539662de16.1370512966.git.michael-dev@fami-braun.de |
---|---|
State | Superseded |
Headers | show |
On Fri, May 17, 2013 at 04:12:12PM +0200, Michael Braun wrote: > Everything in hostapd can be implemented efficiently without vlan_tail. > diff --git a/hostapd/config_file.c b/hostapd/config_file.c > @@ -93,11 +93,8 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss, > > vlan->vlan_id = vlan_id; > os_strlcpy(vlan->ifname, pos, sizeof(vlan->ifname)); > - if (bss->vlan_tail) > - bss->vlan_tail->next = vlan; > - else > - bss->vlan = vlan; > - bss->vlan_tail = vlan; > + vlan->next = bss->vlan; > + bss->vlan = vlan; This would use reverse order for the VLAN list. Can that cause any issues, e.g., with wildcard entries used with non-wildcard and which one would be picked in such case?
diff --git a/hostapd/config_file.c b/hostapd/config_file.c index cd9c7ca..eb049fe 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -93,11 +93,8 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss, vlan->vlan_id = vlan_id; os_strlcpy(vlan->ifname, pos, sizeof(vlan->ifname)); - if (bss->vlan_tail) - bss->vlan_tail->next = vlan; - else - bss->vlan = vlan; - bss->vlan_tail = vlan; + vlan->next = bss->vlan; + bss->vlan = vlan; } fclose(f); diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 2d918f0..e15fa9c 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -331,7 +331,7 @@ struct hostapd_bss_config { int wmm_enabled; int wmm_uapsd; - struct hostapd_vlan *vlan, *vlan_tail; + struct hostapd_vlan *vlan; macaddr bssid; diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c index dd234a0..5da148a 100644 --- a/src/ap/vlan_init.c +++ b/src/ap/vlan_init.c @@ -1002,11 +1002,8 @@ int vlan_init(struct hostapd_data *hapd) vlan->vlan_id = VLAN_ID_WILDCARD; os_snprintf(vlan->ifname, sizeof(vlan->ifname), "%s.#", hapd->conf->iface); - if (hapd->conf->vlan_tail) - hapd->conf->vlan_tail->next = vlan; - else - hapd->conf->vlan = vlan; - hapd->conf->vlan_tail = vlan; + vlan->next = hapd->conf->vlan; + hapd->conf->vlan = vlan; } if (vlan_dynamic_add(hapd, hapd->conf->vlan))