Changeset 37286


Ignore:
Timestamp:
2013-07-14T15:19:58+02:00 (5 years ago)
Author:
hauke
Message:

brcm47xx: fix switch handling

This fixes some problems with the switch handling

  • It now send the messages again to indicate a button for failsafe mode should be pressed
  • it does not leak packages between wan and lan any more
  • the switch works again in normal mode

The Ethernet connection has to be up when the switch driver switch-robo
is insmoded therefor we just do it again.
Explicitly set enable_vlan to prevent leaking packages.

This should close #13869, #13868 and #13716

Location:
trunk/target/linux/brcm47xx/base-files/lib/preinit
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/brcm47xx/base-files/lib/preinit/05_init_interfaces_brcm

    r37284 r37286  
    1212                "Sitecom WL-105b") ifname=eth1;; 
    1313        esac 
     14 
     15        # The interface has to be up to configure the switch 
    1416        ifconfig $ifname 0.0.0.0 up 
     17        [ -f /lib/modules/`uname -r`/switch-robo.ko ] && { 
     18                rmmod switch-robo 
     19                insmod switch-robo 
     20        } 
     21        [ -f /lib/modules/`uname -r`/switch-adm.ko ] && { 
     22                rmmod switch-adm 
     23                insmod switch-adm 
     24        } 
    1525} 
    1626 
  • trunk/target/linux/brcm47xx/base-files/lib/preinit/05_set_failsafe_switch_brcm

    r35704 r37286  
    33failsafe_ip() { 
    44        [ -d /proc/switch/eth0 ] && [ "$ifname" = "eth0" ] && { 
    5                 ifconfig eth0 0.0.0.0 down 
     5                # The switch will connect all ports, The switch will leak 
     6                # packages from wan to lan and vice versa in failsafe mode 
     7                echo 1 > /proc/switch/eth0/reset 
     8                echo 1 > /proc/switch/eth0/enable 
     9                echo 0 > /proc/switch/eth0/enable_vlan 
    610                echo "0 1 2 3 4 ${cpu_port:-5u*}" > /proc/switch/eth0/vlan/1/ports 
    711        } 
     
    913        [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && { 
    1014                ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up 
    11         } 
     15        } 
    1216} 
    1317 
  • trunk/target/linux/brcm47xx/base-files/lib/preinit/15_set_preinit_interface_brcm

    r35704 r37286  
    11#!/bin/sh 
    22 
    3 port_net_echo() { 
    4         [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && { 
    5                 if [ "$pi_preinit_net_messages" = "y" ] || [ "$pi_failsafe_net_message" = "true" ] && [ "$pi_preinit_no_failsafe_netmsg" != "y" ]; then 
    6                         netmsg $pi_broadcast "$1" 
    7                 fi 
    8         } 
    9 } 
    10  
    11 preinit_ip_deconfig() { 
    12         if [ -z "$pi_ifname" ]; then 
    13                 ifconfig $ifname 0.0.0.0 down 
    14         else 
    15                 grep -q "$pi_ifname" /proc/net/dev && { 
    16                         ifconfig $pi_ifname 0.0.0.0 down 
    17                 } 
    18         fi 
    19 } 
    20  
    21 preinit_net_echo() { 
     3preinit_net_echo_send() { 
    224        preinit_ip 
    235 
    246        [ -d /proc/switch/eth0 ] && [ "$pi_ifname" = "eth0" ] && { 
     7 
    258                echo 1 > /proc/switch/eth0/reset 
     9                echo 1 > /proc/switch/eth0/enable 
     10                echo 1 > /proc/switch/eth0/enable_vlan 
    2611 
    2712                # this would be easier if we blasted the message across all ports 
    2813                # but we don't want packets leaking across interfaces 
    2914                for port in $(seq 0 4); do { 
     15 
    3016                        echo "$port ${cpu_port:-5u*}" > /proc/switch/eth0/vlan/1/ports 
    31                         port_net_echo $1 
     17                        sleep 1 
     18 
     19                        netmsg $pi_broadcast "$1" 
    3220                }; done 
    3321 
    34                 echo "0 1 2 3 4 ${cpu_port:-5u*}" > /proc/switch/eth0/vlan/1/ports 
     22        } || netmsg $pi_broadcast "$1" 
     23} 
    3524 
    36         } || port_net_echo $1 
     25preinit_net_echo() { 
     26        [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && { 
     27                {  
     28                        [ "$pi_preinit_net_messages" = "y" ] || { 
     29                                [ "$pi_failsafe_net_message"  = "true" ] &&  
     30                                    [ "$pi_preinit_no_failsafe_netmsg" != "y" ]  
     31                         } 
     32                } && preinit_net_echo_send $1 
     33        } 
    3734} 
Note: See TracChangeset for help on using the changeset viewer.