mac80211: make the path phy lookup more robust regarding config upgrades, allow partial path matching
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 48425
This commit is contained in:
		| @@ -394,11 +394,10 @@ mac80211_generate_mac() { | |||||||
| find_phy() { | find_phy() { | ||||||
| 	[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0 | 	[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0 | ||||||
| 	[ -n "$path" ] && { | 	[ -n "$path" ] && { | ||||||
| 		for phy in /sys/devices/$path/ieee80211/phy*; do | 		for phy in $(ls /sys/class/ieee80211 2>/dev/null); do | ||||||
| 			[ -e "$phy" ] && { | 			case "$(readlink -f /sys/class/ieee80211/$phy/device)" in | ||||||
| 				phy="${phy##*/}" | 				*$path) return 0;; | ||||||
| 				return 0 | 			esac | ||||||
| 			} |  | ||||||
| 		done | 		done | ||||||
| 	} | 	} | ||||||
| 	[ -n "$macaddr" ] && { | 	[ -n "$macaddr" ] && { | ||||||
|   | |||||||
| @@ -10,10 +10,9 @@ lookup_phy() { | |||||||
| 	config_get devpath "$device" path | 	config_get devpath "$device" path | ||||||
| 	[ -n "$devpath" ] && { | 	[ -n "$devpath" ] && { | ||||||
| 		for _phy in /sys/devices/$devpath/ieee80211/phy*; do | 		for _phy in /sys/devices/$devpath/ieee80211/phy*; do | ||||||
| 			[ -e "$_phy" ] && { | 			case "$(readlink -f /sys/class/ieee80211/$_phy/device)" in | ||||||
| 				phy="${_phy##*/}" | 				*$devpath) return 0;; | ||||||
| 				return | 			esac | ||||||
| 			} |  | ||||||
| 		done | 		done | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Felix Fietkau
					Felix Fietkau