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>
This commit is contained in:
parent
7f9d3a00d8
commit
6603748e0c
@ -667,13 +667,28 @@ mac80211_iw_interface_add() {
|
|||||||
return $rc
|
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() {
|
mac80211_prepare_vif() {
|
||||||
json_select config
|
json_select config
|
||||||
|
|
||||||
json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file
|
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}"
|
[ -n "$ifname" ] || {
|
||||||
if_idx=$((${if_idx:-0} + 1))
|
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 wds 0
|
||||||
set_default powersave 0
|
set_default powersave 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user