rename -brcm-2.4 preinit files to -brcm, as they're shared with brcm47xx
[openwrt/svn-archive/archive.git] / target / linux / brcm-2.4 / base-files / lib / preinit / 15_set_preinit_interface_brcm
1 . /etc/functions.sh
2
3 port_net_echo() {
4 [ -n "$pi_ifname" ] && grep "$pi_ifname" /proc/net/dev >/dev/null ] {
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 }
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 "$pi_ifname" /proc/net/dev >/dev/null && {
16 ifconfig $pi_ifname 0.0.0.0 down
17 }
18 fi
19 }
20
21 preinit_net_echo() {
22 preinit_ip
23
24 [ -d /proc/switch/eth0 ] && [ "$pi_ifname" = "eth0" ] && {
25 echo 1 > /proc/switch/eth0/reset
26
27 # this would be easier if we blasted the message across all ports
28 # but we don't want packets leaking across interfaces
29 for port in $(seq 0 4); do {
30 echo "$port ${cpu_port:-5u*}" > /proc/switch/eth0/vlan/0/ports
31 port_net_echo $1
32 }; done
33 } || port_net_echo $1
34
35 preinit_ip_deconfig
36 }
37
38