Root/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx

1#!/bin/sh
2
3port_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
11preinit_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    [ -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"
22    }
23
24}
25
26preinit_net_echo() {
27    preinit_ip
28    
29    [ -d "/proc/switch/$ifname" ] && {
30        echo 1 > "/proc/switch/$ifname/reset"
31
32        # this would be easier if we blasted the message across all ports
33        # but we don't want packets leaking across interfaces
34        for port in $(seq 0 4); do {
35            echo "$port ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports"
36            port_net_echo $1
37        }; done
38        
39        echo "0 ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports"
40        
41    } || port_net_echo $1
42}
43
44
45

Archive Download this file



interactive