openvswitch and hostap?

James Harper james
Sun Nov 23 23:32:59 PST 2014

> On Sat, Nov 15, 2014 at 01:28:20AM +0000, James Harper wrote:
> > I just threw this patch together. It runs the 'ovs-vsctl port-to-br' command
> to determine the name of the bridge, falling back to the old bridge detection
> method if that fails.
> >
> > It could be further developed to also add and remove the interface etc, but
> that's not really the way openvswitch works - interfaces are sticky wrt bridge
> membership and you don't need to re-add them each boot etc.
> >
> > Another option would be to add a config parameter that says "don't do any
> > bridge configuration".
> I cannot really claim to be familiar with Open vSwitch and why it would
> be used with a WLAN interface, so could you please provide some more
> details on what exact fails without this change? Do you configure the
> bridge=<ifname> parameter in hostapd.conf? If so, does this fail with
> "nl80211: Adding interface .. into bridge .."?

I can't remember exactly what the error was, but it definitely fails with some error. Basically the bridge interface exists but hostapd can't access the /sys/xxx files it expects and gives up an error.

> The default behavior in hostapd will likely need to continue to manage
> some bridge cases, e.g., due to limitations on WLAN interface not being
> allowed to be add to Linux bridge in station mode (i.e., it needs to
> happen only after hostapd has been started). While it would be possible
> to do something external to manage this, I'm not aware of very good ways
> of doing that (especially with dynamic VLAN interface addition adding
> complexity).
> I think I'd rather handle Open vSwitch in as simple way as possible and
> that may indeed be that not doing anything apart from providing the
> bridge ifname in hostapd.conf so that packet sockets can be bound to
> receive frames from the correct interface.
> Would it be simpler to detect that the configured bridge netdev is Open
> VSwitch case rather than the Linux bridge? I'd assume the latter could
> at least be identified pretty easily, so the linux_br_add_if() call
> could be skipped if brname is not recognized as the Linux bridge.

I had considered that too. If I understand what you are saying, it would be:
. detect bridge= option
. detect that bridge interface itself already exists
. detect that /sys/.../bridge doesn't exist
. assume that the user knows what they are doing and don't touch any bridge stuff

My patch simplifies the user experience though. Ovs already has the wlanX interface added as a bridge port (even if it appears later it is still already configured as a bridge port), so you simply say interface=wlan0 and hostapd figures out the rest.

I assume Linux will continue to support the old bridge code for a long while yet, but I use openvswitch everywhere else so had hoped it could 'just work' with hostapd too.


More information about the Hostap mailing list