Lines Matching full:vlan
2 * hostapd / VLAN initialization
22 static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
31 "VLAN: Refusing to set up VLAN iface %s with WEP",
32 vlan->ifname);
36 if (!iface_exists(vlan->ifname))
37 ret = hostapd_vlan_if_add(hapd, vlan->ifname);
46 ifconfig_up(vlan->ifname); /* else wpa group will fail fatal */
49 ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id);
54 wpa_printf(MSG_ERROR, "WPA initialization for VLAN %d failed (%d)",
55 vlan->vlan_id, ret);
56 if (wpa_auth_release_group(hapd->wpa_auth, vlan->vlan_id))
57 wpa_printf(MSG_ERROR, "WPA deinit of %s failed", vlan->ifname);
60 if (hostapd_vlan_if_remove(hapd, vlan->ifname))
61 wpa_printf(MSG_ERROR, "Removal of %s failed", vlan->ifname);
67 int vlan_if_remove(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
71 ret = wpa_auth_release_group(hapd->wpa_auth, vlan->vlan_id);
74 "WPA deinitialization for VLAN %d failed (%d)",
75 vlan->vlan_id, ret);
77 return hostapd_vlan_if_remove(hapd, vlan->ifname);
82 struct hostapd_vlan *vlan)
84 while (vlan) {
85 if (vlan->vlan_id != VLAN_ID_WILDCARD) {
86 if (vlan_if_add(hapd, vlan, 1)) {
88 "VLAN: Could not add VLAN %s: %s",
89 vlan->ifname, strerror(errno));
93 vlan_newlink(vlan->ifname, hapd);
97 vlan = vlan->next;
105 struct hostapd_vlan *vlan)
109 while (vlan) {
110 next = vlan->next;
114 if (vlan->vlan_id != VLAN_ID_WILDCARD)
115 vlan_dellink(vlan->ifname, hapd);
117 if (vlan->vlan_id != VLAN_ID_WILDCARD &&
118 vlan_if_remove(hapd, vlan)) {
119 wpa_printf(MSG_ERROR, "VLAN: Could not remove VLAN "
121 vlan->ifname, strerror(errno));
125 vlan = next;
138 !hapd->conf->vlan) {
140 struct hostapd_vlan *vlan;
141 vlan = os_zalloc(sizeof(*vlan));
142 if (vlan == NULL) {
144 "VLAN interfaces");
148 vlan->vlan_id = VLAN_ID_WILDCARD;
149 os_snprintf(vlan->ifname, sizeof(vlan->ifname), "%s.#",
151 vlan->next = hapd->conf->vlan;
152 hapd->conf->vlan = vlan;
155 if (vlan_dynamic_add(hapd, hapd->conf->vlan))
164 vlan_dynamic_remove(hapd, hapd->conf->vlan);
174 struct hostapd_vlan *vlan,
181 if (vlan == NULL || vlan->vlan_id != VLAN_ID_WILDCARD)
184 wpa_printf(MSG_DEBUG, "VLAN: %s(vlan_id=%d ifname=%s)",
185 __func__, vlan_id, vlan->ifname);
186 os_strlcpy(ifname, vlan->ifname, sizeof(ifname));
204 n->next = hapd->conf->vlan;
205 hapd->conf->vlan = n;
207 /* hapd->conf->vlan needs this new VLAN here for WPA setup */
209 hapd->conf->vlan = n->next;
220 struct hostapd_vlan *vlan;
225 wpa_printf(MSG_DEBUG, "VLAN: %s(ifname=%s vlan_id=%d)",
228 vlan = hapd->conf->vlan;
229 while (vlan) {
230 if (vlan->vlan_id == vlan_id && vlan->dynamic_vlan > 0) {
231 vlan->dynamic_vlan--;
234 vlan = vlan->next;
237 if (vlan == NULL)
240 if (vlan->dynamic_vlan == 0) {
241 vlan_if_remove(hapd, vlan);
243 vlan_dellink(vlan->ifname, hapd);