set mode from AP to STATION failed

Felix Liao Felix.Liao at watchguard.com
Thu Dec 6 03:45:58 EST 2012


Hi Jouni,

I notice that when I terminate the hostapd process, hostapd quit with some error messages as below:

1354779885.766019: mgmt::action cb
^C1354779913.212527: Signal 2 received - terminating
1354779913.212810: wpa_driver_nl80211_set_key: ifindex=13 alg=0 addr=0x10089480 key_idx=0 set_tx=1 seq_len=0 key_len=0
1354779913.212860:    addr=a0:0b:ba:b6:c0:fe
1354779913.212997: Removing station a0:0b:ba:b6:c0:fe
1354779913.213044: ath1: AP-STA-DISCONNECTED a0:0b:ba:b6:c0:fe
1354779913.213282: hostapd_ht_operation_update current operation mode=0x4
1354779913.213315: hostapd_ht_operation_update new operation mode=0x4 changes=0
1354779913.213488: wpa_driver_nl80211_set_key: ifindex=13 alg=0 addr=0x10087940 key_idx=0 set_tx=1 seq_len=0 key_len=0
1354779913.213531:    addr=ec:17:2f:cd:11:d7
1354779913.213625: Removing station ec:17:2f:cd:11:d7
1354779913.213667: ath1: AP-STA-DISCONNECTED ec:17:2f:cd:11:d7
1354779913.213900: hostapd_ht_operation_update current operation mode=0x4
1354779913.213933: hostapd_ht_operation_update new operation mode=0x4 changes=0
1354779913.214104: wpa_driver_nl80211_set_key: ifindex=13 alg=0 addr=0x10087670 key_idx=0 set_tx=1 seq_len=0 key_len=0
1354779913.214147:    addr=9c:4e:36:36:b5:9c
1354779913.214241: Removing station 9c:4e:36:36:b5:9c
1354779913.214285: ath1: AP-STA-DISCONNECTED 9c:4e:36:36:b5:9c
1354779913.214454: hostapd_ht_operation_update current operation mode=0x4
1354779913.214484: hostapd_ht_operation_update new operation mode=0x4 changes=0
1354779913.214556: nl80211: Set beacon (beacon_set=1)
1354779913.215102: wpa_driver_nl80211_set_key: ifindex=13 alg=0 addr=0x100873e0 key_idx=0 set_tx=1 seq_len=0 key_len=0
1354779913.215147:    addr=38:59:f9:e4:a6:75
1354779913.215241: Removing station 38:59:f9:e4:a6:75
1354779913.215292: ath1: AP-STA-DISCONNECTED 38:59:f9:e4:a6:75
1354779913.215482: hostapd_ht_operation_update current operation mode=0x4
1354779913.215514: hostapd_ht_operation_update new operation mode=0x0 changes=1
1354779913.215581: nl80211: Set beacon (beacon_set=1)
1354779913.215889: Flushing old station entries
1354779913.216002: Deauthenticate all stations
1354779913.216185: Control interface directory not empty - leaving it behind
1354779913.216245: nl80211: Remove interface ifindex=90
1354779913.473584: netlink: Operstate: linkmode=0, operstate=6
1354779913.476658: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779913.476869: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779913.476903: nl80211: Try mode change after setting interface down
1354779913.476929: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779913.477008: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779913.578444: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779913.578632: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779913.680081: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779913.680274: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779913.781662: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779913.781835: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779913.883312: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779913.883520: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779913.984819: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779913.984993: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779914.086417: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779914.086606: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779914.188074: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779914.188275: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779914.289882: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779914.290084: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779914.391457: nl80211: Set mode ifindex 13 iftype 2 (STATION)
1354779914.391644: nl80211: Failed to set interface 13 to mode 2: -16 (Device or resource busy)
1354779914.492049: nl80211: Interface mode change to 2 from 3 failed

I traced this issue and found that they are output from wpa_driver_nl80211_set_mode() in wpa_driver_nl80211_deinit(), at last called by hostapd_interface_deinit_free().
the kernel API cfg80211_change_iface() deal with this NL80211_CMD_SET_INTERFACE command, but return -EBUSY since the device is still in the bridge,

cfg80211: src/net/wireless/util.c
783 int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
784               struct net_device *dev, enum nl80211_iftype ntype,
785               u32 *flags, struct vif_params *params)
786 {
...
800     /* if it's part of a bridge, reject changing type to station/ibss */
801     if (br_port_exists(dev) &&
802         (ntype == NL80211_IFTYPE_ADHOC ||
803          ntype == NL80211_IFTYPE_STATION ||
804          ntype == NL80211_IFTYPE_P2P_CLIENT))
805         return -EBUSY;
...
872 }

I notice that we have tried to delete this interface from the bridge in wpa_driver_nl80211_deinit(),

2612 static void wpa_driver_nl80211_deinit(void *priv)
2613 {
...
2624     if (bss->added_if_into_bridge) {
2625         if (linux_br_del_if(drv->global->ioctl_sock, bss->brname,
2626                     bss->ifname) < 0)
2627             wpa_printf(MSG_INFO, "nl80211: Failed to remove "
2628                    "interface %s from bridge %s: %s",
2629                    bss->ifname, bss->brname, strerror(errno));
2630     }
...
2682 }

But I trace that the bss->added_if_into_bridge is always 0, so the interface still in the bridge. What I fix to make it correct is set bss->added_if_into_bridge to 1 when we check the bridge,

==== a/hostapd/1.0/src/drivers/driver_nl80211.c#2 - b/hostapd/1.0/src/drivers/driver_nl80211.c ====
6559 static int i802_check_bridge(struct wpa_driver_nl80211_data *drv,
6560                  struct i802_bss *bss,
6561                  const char *brname, const char *ifname)
=============
6584c6584,6585
<                            if (os_strcmp(in_br, brname) == 0)
---
>                            if (os_strcmp(in_br, brname) == 0) {
>                                           bss->added_if_into_bridge = 1;
6585a6587
>                            }

Now this issue has been gone when we quit hostapd, do you think this is right?

Thanks,
- Felix

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20121206/42363fe5/attachment-0001.htm 


More information about the HostAP mailing list