Changeset 24186


Ignore:
Timestamp:
2010-11-28T23:04:26+01:00 (7 years ago)
Author:
cshore
Message:

bcm63xx: Don't hardcode the switch ethernet interface in preinit.

Currently eth1 is hardcoded as the expected interface switches in diagmode.
This patch replaces the eth1 with the ifname, and also directly tests if
the interface specified by ifname has a switch attached.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@…>

Location:
trunk/target/linux/brcm63xx/base-files/lib/preinit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx

    r21629 r24186  
    22 
    33failsafe_ip() { 
    4         [ -d /proc/switch/eth1 ] && [ "$ifname" = "eth1" ] && { 
    5                 ifconfig eth1 0.0.0.0 down 
    6                 echo "0 1 2 3 4 ${cpu_port:-5u*}" > /proc/switch/eth1/vlan/0/ports 
     4        [ -d "/proc/switch/$ifname" ] && { 
     5                ifconfig "$ifname" 0.0.0.0 down 
     6                echo "0 1 2 3 4 ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports" 
    77        } 
    88         
  • trunk/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx

    r21629 r24186  
    1717                } 
    1818        fi 
    19         [ -d /proc/switch/eth1 ] && [ "$ifname" = "eth1" ] && { 
    20                 echo 1 >/proc/switch/eth1/reset 
    21                 echo "0 1 2 3 4 ${cpu_port:-5u*}" > /proc/switch/eth1/vlan/0/ports 
     19        [ -d "/proc/switch/$ifname" ] && { 
     20                echo 1 > "/proc/switch/$ifname/reset" 
     21                echo "0 1 2 3 4 ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports" 
    2222        } 
    2323 
     
    2727        preinit_ip 
    2828         
    29         [ -d /proc/switch/eth1 ] && [ "$ifname" = "eth1" ] && { 
    30                 echo 1 >/proc/switch/eth1/reset 
     29        [ -d "/proc/switch/$ifname" ] && { 
     30                echo 1 > "/proc/switch/$ifname/reset" 
    3131 
    3232                # this would be easier if we blasted the message across all ports 
    3333                # but we don't want packets leaking across interfaces 
    3434                for port in $(seq 0 4); do { 
    35                         echo "$port ${cpu_port:-5u*}" > /proc/switch/eth1/vlan/0/ports 
     35                        echo "$port ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports" 
    3636                        port_net_echo $1 
    3737                }; done 
    3838                 
    39                 echo "0 ${cpu_port:-5u*}" > /proc/switch/eth1/vlan/0/ports 
     39                echo "0 ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports" 
    4040                 
    4141        } || port_net_echo $1 
Note: See TracChangeset for help on using the changeset viewer.