Skip to content
Snippets Groups Projects
Commit 41dbf195 authored by Sukru Senli's avatar Sukru Senli
Browse files

iopsys-econet: remove econet specific switch config

parent aa7b04f2
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
. /lib/functions.sh
WANDEV=
LANDEVS=
tc3162_eth_portmap() {
wan_port="-1"
lan1_port="-1"
lan2_port="-1"
lan3_port="-1"
lan4_port="-1"
lan5_port="-1"
lan6_port="-1"
case "$WANDEV" in
eth0.[0-9])
wan_port=${WANDEV:5}
;;
esac
lan_ports="$(echo $LANDEVS | tr -d 'eth0.')"
port_num=$(echo $lan_ports | wc -w)
[ $port_num -gt 0 ] && lan1_port="$(echo $lan_ports | cut -d' ' -f1)"
[ $port_num -gt 1 ] && lan2_port="$(echo $lan_ports | cut -d' ' -f2)"
[ $port_num -gt 2 ] && lan3_port="$(echo $lan_ports | cut -d' ' -f3)"
[ $port_num -gt 3 ] && lan4_port="$(echo $lan_ports | cut -d' ' -f4)"
[ $port_num -gt 4 ] && lan5_port="$(echo $lan_ports | cut -d' ' -f5)"
[ $port_num -gt 5 ] && lan6_port="$(echo $lan_ports | cut -d' ' -f6)"
echo $wan_port $lan1_port $lan2_port $lan3_port $lan4_port $lan5_port $lan6_port > /proc/tc3162/eth_portmap
}
assign_to_lan_wan(){
local cfg=$1
local ifname uplink
config_get ifname $cfg ifname
[ -d /sys/class/net/$ifname ] || return 0
config_get_bool uplink $cfg uplink 0
if [ $uplink -eq 1 ]; then
WANDEV="$ifname"
else
LANDEVS="$LANDEVS $ifname"
fi
}
setup_switch() {
[ -d /proc/tc3162 ] || return 0
[ -f /etc/config/ports ] || return 0
config_load ports
config_foreach assign_to_lan_wan ethport
[ -n "$WANDEV" -o -n "$LANDEVS" ] && tc3162_eth_portmap
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment