rework bssid handling and stop all used bssids when leaving RUN

Instead of haing a pool of unsused BSS Id's and a list of active
BSS's (wlans), use a single array and only mark the BSS Id as used
or unused.

When leaving RUN state, release (stop) all used BSS.
This commit is contained in:
Andreas Schultz
2016-03-29 15:28:40 +02:00
parent 40a98c9075
commit 32e9567f7b
4 changed files with 104 additions and 102 deletions

View File

@ -619,12 +619,12 @@ static int wtp_parsing_radio_section_configuration(config_setting_t* configSetti
continue;
uint8_t bssid;
char wlanname[IFNAMSIZ];
struct capwap_list_item* itemwlan;
struct wtp_radio_wlanpool* wlanpool;
/* Create interface */
for (bssid = 0; bssid < radio->radioconfig.maxbssid; bssid++) {
char wlanname[IFNAMSIZ];
struct wtp_radio_wlan *wlan;
sprintf(wlanname, "%s%02d.%02d", radio->wlanprefix, (int)radio->radioid, (int)bssid + 1);
if (wifi_iface_index(wlanname)) {
capwap_logging_error("interface %s already exists", wlanname);
@ -632,18 +632,16 @@ static int wtp_parsing_radio_section_configuration(config_setting_t* configSetti
}
/* */
itemwlan = capwap_itemlist_create(sizeof(struct wtp_radio_wlanpool));
wlanpool = (struct wtp_radio_wlanpool*)itemwlan->item;
wlanpool->radio = radio;
wlanpool->wlanhandle = wifi_wlan_create(radio->devicehandle, wlanname);
if (!wlanpool->wlanhandle) {
wlan = (struct wtp_radio_wlan *)capwap_array_get_item_pointer(radio->wlan, bssid + 1);
wlan->in_use = 0;
wlan->radio = radio;
wlan->wlanhandle = wifi_wlan_create(radio->devicehandle, wlanname);
if (!wlan->wlanhandle) {
capwap_logging_error("Unable to create interface: %s", wlanname);
return 0;
}
/* Appent to wlan pool */
capwap_logging_debug("Created wlan interface: %s", wlanname);
capwap_itemlist_insert_after(radio->wlanpool, NULL, itemwlan);
}
}