static void vlan_newlink(char *ifname, struct hostapd_data *hapd) { char vlan_ifname[IFNAMSIZ]; char br_name[IFNAMSIZ]; struct hostapd_vlan *vlan = hapd->conf->vlan; char *tagged_interface = hapd->conf->ssid.vlan_tagged_interface; while (vlan) { if (strcmp(ifname, vlan->ifname) == 0) { snprintf(br_name, sizeof(br_name), "brvlan%d", vlan->vlan_id); if (!br_addbr(br_name)) vlan->clean |= DVLAN_CLEAN_BR; ifconfig_up(br_name); if (tagged_interface) { if (!vlan_add(tagged_interface, vlan->vlan_id)) vlan->clean |= DVLAN_CLEAN_VLAN; snprintf(vlan_ifname, sizeof(vlan_ifname), "vlan%d", vlan->vlan_id); if (!br_addif(br_name, vlan_ifname)) vlan->clean |= DVLAN_CLEAN_VLAN_PORT; ifconfig_up(vlan_ifname); } if (!br_addif(br_name, ifname)) vlan->clean |= DVLAN_CLEAN_WLAN_PORT; ifconfig_up(ifname); break; } vlan = vlan->next; } }
static void vlan_newlink(char *ifname, struct hostapd_data *hapd) { char vlan_ifname[IFNAMSIZ]; char br_name[IFNAMSIZ]; struct hostapd_vlan *vlan = hapd->conf->vlan; char *tagged_interface = hapd->conf->ssid.vlan_tagged_interface; int vlan_naming = hapd->conf->ssid.vlan_naming; int clean; wpa_printf(MSG_DEBUG, "VLAN: vlan_newlink(%s)", ifname); while (vlan) { if (os_strcmp(ifname, vlan->ifname) == 0 && !vlan->configured) { vlan->configured = 1; if (hapd->conf->vlan_bridge[0]) { os_snprintf(br_name, sizeof(br_name), "%s%d", hapd->conf->vlan_bridge, vlan->vlan_id); } else if (tagged_interface) { os_snprintf(br_name, sizeof(br_name), "br%s.%d", tagged_interface, vlan->vlan_id); } else { os_snprintf(br_name, sizeof(br_name), "brvlan%d", vlan->vlan_id); } dyn_iface_get(hapd, br_name, br_addbr(br_name) ? 0 : DVLAN_CLEAN_BR); ifconfig_up(br_name); if (tagged_interface) { if (vlan_naming == DYNAMIC_VLAN_NAMING_WITH_DEVICE) os_snprintf(vlan_ifname, sizeof(vlan_ifname), "%s.%d", tagged_interface, vlan->vlan_id); else os_snprintf(vlan_ifname, sizeof(vlan_ifname), "vlan%d", vlan->vlan_id); clean = 0; ifconfig_up(tagged_interface); if (!vlan_add(tagged_interface, vlan->vlan_id, vlan_ifname)) clean |= DVLAN_CLEAN_VLAN; if (!br_addif(br_name, vlan_ifname)) clean |= DVLAN_CLEAN_VLAN_PORT; dyn_iface_get(hapd, vlan_ifname, clean); ifconfig_up(vlan_ifname); } if (!br_addif(br_name, ifname)) vlan->clean |= DVLAN_CLEAN_WLAN_PORT; ifconfig_up(ifname); break; } vlan = vlan->next; } }