Parcourir la source

VLAN: Fix bridge interface clean up for no tagged_interface case

Jouni Malinen il y a 15 ans
Parent
commit
b9c3e576cb
1 fichiers modifiés avec 11 ajouts et 7 suppressions
  1. 11 7
      src/ap/vlan_init.c

+ 11 - 7
src/ap/vlan_init.c

@@ -526,7 +526,6 @@ static void vlan_dellink(char *ifname, struct hostapd_data *hapd)
 	char br_name[IFNAMSIZ];
 	struct hostapd_vlan *first, *prev, *vlan = hapd->conf->vlan;
 	char *tagged_interface = hapd->conf->ssid.vlan_tagged_interface;
-	int numports;
 
 	wpa_printf(MSG_DEBUG, "VLAN: vlan_dellink(%s)", ifname);
 
@@ -537,19 +536,24 @@ static void vlan_dellink(char *ifname, struct hostapd_data *hapd)
 			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);
+
 			if (tagged_interface) {
 				os_snprintf(vlan_ifname, sizeof(vlan_ifname),
 					    "vlan%d", vlan->vlan_id);
-
-				numports = br_getnumports(br_name);
-				if (numports == 1) {
+				if (vlan->clean & DVLAN_CLEAN_VLAN_PORT)
 					br_delif(br_name, vlan_ifname);
+				ifconfig_down(vlan_ifname);
 
+				if (vlan->clean & DVLAN_CLEAN_VLAN)
 					vlan_rem(vlan_ifname);
+			}
 
-					ifconfig_down(br_name);
-					br_delbr(br_name);
-				}
+			if ((vlan->clean & DVLAN_CLEAN_BR) &&
+			    br_getnumports(br_name) == 0) {
+				ifconfig_down(br_name);
+				br_delbr(br_name);
 			}
 
 			if (vlan == first) {