From 49ec79e12616a1b221acef6a1bf111c86fc329c5 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 28 Jan 2015 12:07:08 +0000 Subject: mac80211: fix fallback to macaddr If '/sys/class/ieee80211/phyN' is not a symlink, the call to readlink produces either an empty path (if /sys/class/ieee80211/phyN/device doesn't exist) or a path that begins with '/sys/class/ieee80211' (which does not work with the subsequent line to strip '/sys/devices' from the beginning of the path). Modify the checks to detect these conditions, and fallback to using the macaddr. Signed-off-by: Nathan Hintz git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44172 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/kernel/mac80211/files/lib/wifi/mac80211.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'package/kernel') diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index 0b662eb4b1..a7c4d2dbc2 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -94,8 +94,12 @@ detect_mac80211() { [ -n $htmode ] && append ht_capab " option htmode $htmode" "$N" - if [ -x /usr/bin/readlink ]; then + if [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${dev} ]; then path="$(readlink -f /sys/class/ieee80211/${dev}/device)" + else + path="" + fi + if [ -n "$path" ]; then path="${path##/sys/devices/}" dev_id=" option path '$path'" else -- cgit v1.2.3