nl80211: Relax bridge setup

Normally nl80211 driver will attempt to strictly control what bridge
given interface is put in. It'll attempt to remove it from an existing
bridge if it doesn't match the configured one. If it's not in a bridge
it'll try to put it into one. If any of this fails then hostapd will
bail out and not set up the BSS at all.

Arguably that's reasonable since it allows to set the BSS up coherently
with regard to EAPOL handling as well as allows extra interactions with
things like FDB. However, not all hostapd drivers interact with bridge=
the same way. One example is atheros. Therefore it's not clear what the
desired behavior should be if consistency across drivers is considered.

There's a case where one might want to use a non-native Linux bridge,
e.g., openvswitch, in which case regular ioctls won't work to put an
interface into a bridge, or figure out what bridge an interface is in.
The underlying wireless driver can still be an ordinary nl80211 driver.

This change relaxes the bridge setup failure so that hostapd still
starts even if it fails to add an interface into a configured bridge
name. It still sets up all the necessary sockets (including the
configured bridge=) so EAPOL handling should work fine. This then leaves
it to the system integrator to manage wireless interface as bridge ports
and possibly fdb hints too.

Signed-off-by: Michal Kazior <michal@plume.com>
This commit is contained in:
Michal Kazior 2019-10-28 13:49:29 +01:00 committed by Jouni Malinen
parent 3626e72c8d
commit 8e111157e7

View file

@ -6993,10 +6993,14 @@ static int i802_check_bridge(struct wpa_driver_nl80211_data *drv,
wpa_printf(MSG_DEBUG, "nl80211: Adding interface %s into bridge %s", wpa_printf(MSG_DEBUG, "nl80211: Adding interface %s into bridge %s",
ifname, brname); ifname, brname);
if (linux_br_add_if(drv->global->ioctl_sock, brname, ifname) < 0) { if (linux_br_add_if(drv->global->ioctl_sock, brname, ifname) < 0) {
wpa_printf(MSG_ERROR, "nl80211: Failed to add interface %s " wpa_printf(MSG_WARNING,
"into bridge %s: %s", "nl80211: Failed to add interface %s into bridge %s: %s",
ifname, brname, strerror(errno)); ifname, brname, strerror(errno));
return -1; /* Try to continue without the interface being in a bridge. This
* may be needed for some cases, e.g., with Open vSwitch, where
* an external component will need to handle bridge
* configuration. */
return 0;
} }
bss->added_if_into_bridge = 1; bss->added_if_into_bridge = 1;