set mode from AP to STATION failed

Jouni Malinen j
Tue Dec 25 02:25:42 PST 2012

On Thu, Dec 06, 2012 at 08:45:58AM +0000, Felix Liao wrote:
> I notice that when I terminate the hostapd process, hostapd quit with some error messages as below:

> 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)

This is expected behavior if you add the AP interface into a bridge with
some other means other than hostapd doing this.

> 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,

How did you add the interface into the bridge? hostapd should set
bss->added_if_into_bridge to 1 (in i802_check_bridge) if the interface
was added into 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?

hostapd does not do this by design since it sounds like the interface
was added to the bridge by something external. In other words, the
interface is removed from the bridge only if hostapd needed to add it
there in the first place. If the interface was added by some other means
(e.g., setting it to AP mode and adding it with brctl prior to starting
hostapd), the interface is left in the bridge.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list