change wifi init - awk dev from proc - call after br0 creation for wds compatibility
SVN-Revision: 15
This commit is contained in:
		| @@ -16,32 +16,30 @@ mac2if () { | |||||||
|  |  | ||||||
| # allow env to override nvram  | # allow env to override nvram  | ||||||
| nvram_get () { | nvram_get () { | ||||||
|  eval "echo \${$1:=\$(nvram get $1)}" |  eval "echo \${$1:-\$(nvram get $1)}" | ||||||
| } | } | ||||||
|  |  | ||||||
| # valid interface? | # valid interface? | ||||||
| if_valid () { | if_valid () { | ||||||
|   [ "${1%[0-9]}" = "vlan" ] && { |   [ "${1%%[0-9]}" = "vlan" ] && { | ||||||
|     i=${1##vlan}  |     i=${1#vlan}  | ||||||
|     hwname=$(nvram_get vlan${i}hwname) |     hwname=$(nvram_get vlan${i}hwname) | ||||||
|     hwaddr=$(nvram_get ${hwname}macaddr) |     hwaddr=$(nvram_get ${hwname}macaddr) | ||||||
|     [ -z "$hwaddr" ] && return 1 |     [ -z "$hwaddr" ] && return 1 | ||||||
|  |  | ||||||
|     vif=$(mac2if $hwaddr) |     vif=$(mac2if $hwaddr) | ||||||
|     echo "# vlan${i}: $hwname $hwaddr => $vif" |     echo "# vlan$i: $hwname $hwaddr => $vif" | ||||||
|  |  | ||||||
|     $DEBUG ifconfig $vif up |     $DEBUG ifconfig $vif up | ||||||
|     $DEBUG vconfig add $vif $i 2>/dev/null |     $DEBUG vconfig add $vif $i 2>/dev/null | ||||||
|   } |   } | ||||||
|   ifconfig "$1" >/dev/null 2>&1 || [ "${1%[0-9]}" = "br" ]  |   ifconfig "$1" >/dev/null 2>&1 || [ "${1%%[0-9]}" = "br" ]  | ||||||
|   return $? |   return $? | ||||||
| } | } | ||||||
|  |  | ||||||
| wifi_init () { | wifi_init () { | ||||||
|   echo "# --- wifi init ---" |   echo "# --- wifi init ---" | ||||||
|   # assume wifi is eth2, fall back to eth1 |   if=$(awk 'gsub(":","") {print $1}' /proc/net/wireless) | ||||||
|   if="eth2" |  | ||||||
|   if_valid $if || if="eth1" |  | ||||||
|   $DEBUG wlconf $if up |   $DEBUG wlconf $if up | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -50,13 +48,13 @@ configure () { | |||||||
|   echo "# --- $type ---" |   echo "# --- $type ---" | ||||||
|    |    | ||||||
|   if=$(nvram_get ${type}_ifname) |   if=$(nvram_get ${type}_ifname) | ||||||
|   if [ "${if%[0-9]}" = "ppp" ]; then |   if [ "${if%%[0-9]}" = "ppp" ]; then | ||||||
|     if=$(nvram_get pppoe_ifname)  |     if=$(nvram_get pppoe_ifname)  | ||||||
|   fi |   fi | ||||||
|   if_valid $if || return |   if_valid $if || return | ||||||
|    |    | ||||||
|   $DEBUG ifconfig $if down |   $DEBUG ifconfig $if down | ||||||
|   if [ "${if%[0-9]}" = "br" ]; then |   if [ "${if%%[0-9]}" = "br" ]; then | ||||||
|     stp=$(nvram_get ${type}_stp) |     stp=$(nvram_get ${type}_stp) | ||||||
|     $DEBUG brctl delbr $if |     $DEBUG brctl delbr $if | ||||||
|     $DEBUG brctl addbr $if |     $DEBUG brctl addbr $if | ||||||
| @@ -67,7 +65,7 @@ configure () { | |||||||
|       if_valid $sif || continue |       if_valid $sif || continue | ||||||
|       $DEBUG ifconfig $sif 0.0.0.0 up |       $DEBUG ifconfig $sif 0.0.0.0 up | ||||||
|       $DEBUG brctl addif $if $sif  |       $DEBUG brctl addif $if $sif  | ||||||
|     }; done |     } done | ||||||
|   fi |   fi | ||||||
|  |  | ||||||
|   if_mac=$(nvram_get ${type}_hwaddr) |   if_mac=$(nvram_get ${type}_hwaddr) | ||||||
| @@ -92,7 +90,7 @@ configure () { | |||||||
|       echo "# --- creating /etc/resolv.conf ---" |       echo "# --- creating /etc/resolv.conf ---" | ||||||
|       for dns in $(nvram_get ${type}_dns); do { |       for dns in $(nvram_get ${type}_dns); do { | ||||||
| 	echo "nameserver $dns" >> /etc/resolv.conf | 	echo "nameserver $dns" >> /etc/resolv.conf | ||||||
|       }; done |       } done | ||||||
|     ;; |     ;; | ||||||
|     dhcp) |     dhcp) | ||||||
|       pidfile=/tmp/dhcp-${type}.pid |       pidfile=/tmp/dhcp-${type}.pid | ||||||
| @@ -118,8 +116,6 @@ configure () { | |||||||
| } | } | ||||||
|  |  | ||||||
| ### START NETWORKING ### | ### START NETWORKING ### | ||||||
| wifi_init |  | ||||||
|  |  | ||||||
| $DEBUG vconfig set_name_type VLAN_PLUS_VID_NO_PAD | $DEBUG vconfig set_name_type VLAN_PLUS_VID_NO_PAD | ||||||
|  |  | ||||||
| # hacks for 1.x hardware | # hacks for 1.x hardware | ||||||
| @@ -134,11 +130,7 @@ $DEBUG vconfig set_name_type VLAN_PLUS_VID_NO_PAD | |||||||
|   # use the old names to preserve backwards |   # use the old names to preserve backwards | ||||||
|   # compatibility |   # compatibility | ||||||
|   remap () { |   remap () { | ||||||
|     eval $1=\"$(nvram_get $1 | awk '{ |     eval $1=\"$(nvram_get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\" | ||||||
| 	  gsub(/eth0/,"vlan2") |  | ||||||
| 	  gsub(/eth1/,"vlan1") |  | ||||||
| 	  print $0 |  | ||||||
|     }')\" |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   remap lan_ifname |   remap lan_ifname | ||||||
| @@ -168,6 +160,8 @@ configure lan | |||||||
| configure wifi | configure wifi | ||||||
| configure wan | configure wan | ||||||
|  |  | ||||||
|  | wifi_init | ||||||
|  |  | ||||||
| for route in $(nvram_get static_route); do { | for route in $(nvram_get static_route); do { | ||||||
|       ip=${route%%:*} route=${route#*:} |       ip=${route%%:*} route=${route#*:} | ||||||
|  netmask=${route%%:*} route=${route#*:} |  netmask=${route%%:*} route=${route#*:} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Mike Baker
					Mike Baker