Ignore:
Timestamp:
2011-11-06T20:57:07+01:00 (5 years ago)
Author:
jow
Message:

[package] madwifi: change wireless ifname numbering schema
Instead of simply counting up until we hit a free iface, group ifnames by wiphy so that the first wlanX on a phy gets the phy number
and following ifaces an index-suffix, e.g. ath0 for network 1 on phy 1 and ath0-1 for network 2 on phy 1.
This fixes state var confusion when operating multiple radios and allows to reliably take down and restart one radio only, even if
the number of networks changes in between. This should, along with other changes in LuCI, fix #10335.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/madwifi/files/lib/wifi/madwifi.sh

    r28199 r28785  
    3232 
    3333        [ ${device%[0-9]} = "wifi" ] && config_set "$device" phy "$device" 
     34 
     35        local ifidx=0 
    3436         
    3537        config_get vifs "$device" vifs 
     
    3840                [ $disabled = 0 ] || continue 
    3941 
     42                local vifname 
     43                [ $ifidx -gt 0 ] && vifname="ath${device#radio}-$ifidx" || vifname="ath${device#radio}" 
     44 
    4045                config_get ifname "$vif" ifname 
    41                 config_set "$vif" ifname "${ifname:-ath}" 
     46                config_set "$vif" ifname "${ifname:-$vifname}" 
    4247                 
    4348                config_get mode "$vif" mode 
     
    5863                        *) echo "$device($vif): Invalid mode, ignored."; continue;; 
    5964                esac 
     65 
     66                ifidx=$(($ifidx + 1)) 
    6067        done 
    6168 
     
    206213 
    207214                [ "$nosbeacon" = 1 ] || nosbeacon="" 
    208                 ifname=$(wlanconfig "$ifname" create wlandev "$phy" wlanmode "$mode" ${nosbeacon:+nosbeacon}) 
     215                ifname=$(wlanconfig "$ifname" create nounit wlandev "$phy" wlanmode "$mode" ${nosbeacon:+nosbeacon}) 
    209216                [ $? -ne 0 ] && { 
    210217                        echo "enable_atheros($device): Failed to set up $mode vif $ifname" >&2 
Note: See TracChangeset for help on using the changeset viewer.