diff options
author | Felix Fietkau <nbd@nbd.name> | 2022-09-23 14:12:32 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2022-10-14 13:12:36 +0200 |
commit | 6603748e0ca697f484adfc16a0d49d35ed36954d (patch) | |
tree | ee3750d5d2442d6db5e669c810955394d153c193 /package | |
parent | 7f9d3a00d8d41f2bf9fe35b30cd689b9992e7ff9 (diff) | |
download | upstream-6603748e0ca697f484adfc16a0d49d35ed36954d.tar.gz upstream-6603748e0ca697f484adfc16a0d49d35ed36954d.tar.bz2 upstream-6603748e0ca697f484adfc16a0d49d35ed36954d.zip |
mac80211: change default ifname to <phy>-<type><index>
This makes it clear, which phy a wlan device belongs to and also helps with
telling them apart by including the mode in the ifname.
Preparation for automatically renaming PHYs
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package')
-rw-r--r-- | package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index e6f326c2e6..e05a5b8fee 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -667,13 +667,28 @@ mac80211_iw_interface_add() { return $rc } +mac80211_set_ifname() { + local phy="$1" + local prefix="$2" + eval "ifname=\"$phy-$prefix\${idx_$prefix:-0}\"; idx_$prefix=\$((\${idx_$prefix:-0 } + 1))" +} + mac80211_prepare_vif() { json_select config json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file - [ -n "$ifname" ] || ifname="wlan${phy#phy}${if_idx:+-$if_idx}" - if_idx=$((${if_idx:-0} + 1)) + [ -n "$ifname" ] || { + local prefix; + + case "$mode" in + ap|sta|mesh) prefix=$mode;; + adhoc) prefix=ibss;; + monitor) prefix=mon;; + esac + + mac80211_set_ifname "$phy" "$prefix" + } set_default wds 0 set_default powersave 0 |