service netif restart [iface] runs a wpa_supplicant twice
John Baldwin
jhb at freebsd.org
Tue Nov 5 18:23:17 UTC 2013
On Sunday, November 03, 2013 12:56:08 pm Adrian Chadd wrote:
> On 2 November 2013 12:13, clutton <clutton at zoho.com> wrote:
>
> [snip]
>
> > What was happened? netif tries to setup wlan0 (clone, wpa, dhcp, etc),
> > when wlan0 interface occurs, devd runs another copy of netif.
>
> Well, it sounds like we need to pick an architecture _and_ fix the
> behaviour here.
>
> Which is:
>
>
> * I think wpa-supplicant should always run if it's required in /etc/rc.conf;
> * netif should check if devd is configured and if so, just leave the
> configuration up to devd
> * if it isn't running, then devd should be responsible for
> dhclient/add-to-wpa-config
>
> What we first have to establish is whether add_interface and
> remove_interface (or whatever they're called) are correctly working,
> for ethernet and wifi driver types. Then, we need to ensure they can
> coexist (ie, one wpa_supplicant, but with both ethernet/wifi drivers
> loaded and active on their relevant interfaces.) _then_ we can break
> out the "stuff devd does" out of netif and have _either_ netif (x)or
> devd call this new script to setup/teardown the interface runtime
> state.
>
> How's that sound?
Note that devd just runs netif (via /etc/pccard_ether), so it's already
just one script, and having netif bail if devd is running would make
netif not do anything in the common case.
What normally happens during boot is that '/etc/rc.d/netif start' creates
wlan0 and runs wpa_supplicant via 'childif_create' making a nested call to
ifn_start for wlan0. That is, childif_create autoruns /etc/rc.d/netif
explicitly after it creates the device. Probably that is what should be
removed. That would let devd always start wpa_supplicant via
/etc/pccard_ether. I've just tested this by doing a stop/start on iwn0
(parent of wlan0, so wlan0 gets destroyed and re-created) and it started
wpa_supplicant correctly.
Index: head/etc/network.subr
===================================================================
--- network.subr (revision 257705)
+++ network.subr (working copy)
@@ -1429,9 +1429,6 @@ childif_create()
fi
${IFCONFIG_CMD} $i name $child && cfg=0
fi
- if autoif $child; then
- ifn_start $child
- fi
done
# Create vlan interfaces
I also tested vlans created via vlans_<if> and they should use the same fix as
well. Note that this model is more consistent with how cloned_interfaces
works where ifn_start is not explicitly run when each interface is created.
Instead, we rely on devd kicking off pccard_ether for those as well.
--
John Baldwin
More information about the freebsd-wireless
mailing list