Hi, > -----Original Message----- > From: Jonas Gorski [mailto:[email protected]] > Sent: Samstag, 9. November 2019 10:37 > To: Adrian Schmutzler <[email protected]> > Cc: OpenWrt Development List <[email protected]>; Rosy > Song <[email protected]> > Subject: Re: [OpenWrt-Devel] [PATCH 2/2] base-files: rename SSID with EUI > of mac address > > On Fri, 8 Nov 2019 at 12:49, Adrian Schmutzler > <[email protected]> wrote: > > > > If the label MAC address is provided for a device, the default SSID > > will be set to contain the EUI of this address, e.g. OpenWrt-ddeeff. > > > > With multiple routers, this will help the user to identify his device > > based on the MAC address printed on the device. > > > > If no label MAC address is specified, this will use "OpenWrt" as done > > before. > > > > Using a uci-defaults script for this is necessary as mac80211.sh is > > executed before /etc/board.json is created, so label MAC addresses set > > in 02_network would not be available there. > > Unfortunately since we detect wifi async these days this is quite racy, and > there is no guarantee /etc/config/wireless is fully populated by the time the > uci defaults are run. E.g. mwl8k takes quite a while since it uses different > firmwares for STA and AP modes, and it needs to re-initialize to switch > between them (triggered by by mac80211.sh trying to detect the supporte > features).
So, in the end, it might be like Manuel Giganto suggested in GitHub and one might either have to wait in mac80211.sh until /etc/board.json is available (ugly) or just put the same code (the few lines of SSID change) in both locations (uci_defaults AND mac80211.sh). Best Adrian > > > Regards > Jonas > > > > > Suggested-by: Rosy Song <[email protected]> > > Signed-off-by: Adrian Schmutzler <[email protected]> > > > > --- > > > > This effectively uses a workaround to prevent SSID from being reset > > after upgrade (match SSID vs. "OpenWrt"). If there is a nicer option, > > please propose it. > > > > Another option for this would be to explicitly mark the wireless uci > > config as 'default setup' by a to-be-introduced option, which is to be > > removed in a late uci-defaults script. This could then be exploited > > for several other objectives, e.g. further config-dependent WiFi setup > > tasks. > > --- > > .../etc/uci-defaults/15_wifi-ssid-mac-address | 22 > > +++++++++++++++++++ > > 1 file changed, 22 insertions(+) > > create mode 100644 > > package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address > > > > diff --git > > a/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address > > b/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-address > > new file mode 100644 > > index 0000000000..aeb46e39c0 > > --- /dev/null > > +++ b/package/base-files/files/etc/uci-defaults/15_wifi-ssid-mac-addre > > +++ ss > > @@ -0,0 +1,22 @@ > > +. /lib/functions.sh > > +. /lib/functions/system.sh > > + > > +set_wifi_ssid() { > > + local iface="$1" > > + > > + [ "$(uci get "wireless.${iface}.ssid")" = "OpenWrt" ] && \ > > + uci set "wireless.${iface}.ssid=$ssid" > > +} > > + > > +label_macaddr=$(get_mac_label) > > + > > +[ -n "$label_macaddr" ] || exit 0 > > + > > +ssid="OpenWrt-$(macaddr_geteui $label_macaddr)" > > + > > +config_load wireless > > +config_foreach set_wifi_ssid wifi-iface > > + > > +uci commit wireless > > + > > +exit 0 > > -- > > 2.20.1 > > > > > > _______________________________________________ > > openwrt-devel mailing list > > [email protected] > > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
openpgp-digital-signature.asc
Description: PGP signature
_______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
