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

iopsys-econet: handlet eth_portmap based on network config

parent fbfd9ff3
Branches
Tags
No related merge requests found
#!/bin/sh
tc3162_eth_portmap() {
[ -d /proc/tc3162 ] || return 0
wan_port="-1"
lan1_port="-1"
lan2_port="-1"
lan3_port="-1"
lan4_port="-1"
lan5_port="-1"
lan6_port="-1"
wandevice="$(uci -q get network.wan.device)"
case "$wandevice" in
eth0.[0-9])
wan_port=${wandevice:5}
;;
esac
landevice=$(uci -q get network.lan.device)
case "$landevice" in
eth0.[0-9])
lan1_port="${landevice:5}"
;;
br-lan)
section="$(uci show network | grep 'name=.*br-lan' | cut -d'.' -f2)"
lan_ports="$(uci -q get network.$section.ports)"
lan1_port=$(echo $lan_ports | cut -d' ' -f1 | cut -d'.' -f2)
lan1_port="${lan1_port:--1}"
lan2_port=$(echo $lan_ports | cut -d' ' -f2 | cut -d'.' -f2)
lan2_port="${lan2_port:--1}"
lan3_port=$(echo $lan_ports | cut -d' ' -f3 | cut -d'.' -f2)
lan3_port="${lan3_port:--1}"
lan4_port=$(echo $lan_ports | cut -d' ' -f4 | cut -d'.' -f2)
lan4_port="${lan4_port:--1}"
lan5_port=$(echo $lan_ports | cut -d' ' -f5 | cut -d'.' -f2)
lan5_port="${lan5_port:--1}"
lan6_port=$(echo $lan_ports | cut -d' ' -f6 | cut -d'.' -f2)
lan6_port="${lan6_port:--1}"
;;
esac
echo $wan_port $lan1_port $lan2_port $lan3_port $lan4_port $lan5_port $lan6_port > /proc/tc3162/eth_portmap
}
tc3162_eth_portmap
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment