Changeset 15


Ignore:
Timestamp:
2004-05-04T11:38:26+02:00 (14 years ago)
Author:
mbm
Message:

change wifi init

  • awk dev from proc
  • call after br0 creation for wds compatibility
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/root/etc/networking.sh

    r13 r15  
    1717# allow env to override nvram  
    1818nvram_get () { 
    19  eval "echo \${$1:=\$(nvram get $1)}" 
     19 eval "echo \${$1:-\$(nvram get $1)}" 
    2020} 
    2121 
    2222# valid interface? 
    2323if_valid () { 
    24   [ "${1%[0-9]}" = "vlan" ] && { 
    25     i=${1##vlan}  
     24  [ "${1%%[0-9]}" = "vlan" ] && { 
     25    i=${1#vlan}  
    2626    hwname=$(nvram_get vlan${i}hwname) 
    2727    hwaddr=$(nvram_get ${hwname}macaddr) 
     
    2929 
    3030    vif=$(mac2if $hwaddr) 
    31     echo "# vlan${i}: $hwname $hwaddr => $vif" 
     31    echo "# vlan$i: $hwname $hwaddr => $vif" 
    3232 
    3333    $DEBUG ifconfig $vif up 
    3434    $DEBUG vconfig add $vif $i 2>/dev/null 
    3535  } 
    36   ifconfig "$1" >/dev/null 2>&1 || [ "${1%[0-9]}" = "br" ]  
     36  ifconfig "$1" >/dev/null 2>&1 || [ "${1%%[0-9]}" = "br" ]  
    3737  return $? 
    3838} 
     
    4040wifi_init () { 
    4141  echo "# --- wifi init ---" 
    42   # assume wifi is eth2, fall back to eth1 
    43   if="eth2" 
    44   if_valid $if || if="eth1" 
     42  if=$(awk 'gsub(":","") {print $1}' /proc/net/wireless) 
    4543  $DEBUG wlconf $if up 
    4644} 
     
    5149   
    5250  if=$(nvram_get ${type}_ifname) 
    53   if [ "${if%[0-9]}" = "ppp" ]; then 
     51  if [ "${if%%[0-9]}" = "ppp" ]; then 
    5452    if=$(nvram_get pppoe_ifname)  
    5553  fi 
     
    5755   
    5856  $DEBUG ifconfig $if down 
    59   if [ "${if%[0-9]}" = "br" ]; then 
     57  if [ "${if%%[0-9]}" = "br" ]; then 
    6058    stp=$(nvram_get ${type}_stp) 
    6159    $DEBUG brctl delbr $if 
     
    6866      $DEBUG ifconfig $sif 0.0.0.0 up 
    6967      $DEBUG brctl addif $if $sif  
    70     }; done 
     68    } done 
    7169  fi 
    7270 
     
    9391      for dns in $(nvram_get ${type}_dns); do { 
    9492        echo "nameserver $dns" >> /etc/resolv.conf 
    95       }; done 
     93      } done 
    9694    ;; 
    9795    dhcp) 
     
    119117 
    120118### START NETWORKING ### 
    121 wifi_init 
    122  
    123119$DEBUG vconfig set_name_type VLAN_PLUS_VID_NO_PAD 
    124120 
     
    135131  # compatibility 
    136132  remap () { 
    137     eval $1=\"$(nvram_get $1 | awk '{ 
    138           gsub(/eth0/,"vlan2") 
    139           gsub(/eth1/,"vlan1") 
    140           print $0 
    141     }')\" 
     133    eval $1=\"$(nvram_get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\" 
    142134  } 
    143135 
     
    169161configure wan 
    170162 
     163wifi_init 
     164 
    171165for route in $(nvram_get static_route); do { 
    172166      ip=${route%%:*} route=${route#*:} 
Note: See TracChangeset for help on using the changeset viewer.