mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
layer2interface: populate wan ifname with various norhbound interfaces
This commit is contained in:
parent
ca1d9f7fb8
commit
0bbcc75b1e
1 changed files with 20 additions and 16 deletions
|
|
@ -10,14 +10,14 @@ LANPORTS="$(db -q get hw.board.ethernetLanPorts)"
|
|||
ETHDEV=""
|
||||
PTMDEV=""
|
||||
ATMDEV=""
|
||||
WANIFACE=""
|
||||
WANDEV=""
|
||||
WANIFNAME=""
|
||||
|
||||
device_config_exists() {
|
||||
ubus call uci get '{"config":"network","type":"device"}' | grep -w name | grep -qw "$1" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
populate_dsl_settings() {
|
||||
if [ "$hasAdsl" == "0" -a "$hasVdsl" == "0" ]; then
|
||||
rm -f /etc/config/dsl
|
||||
|
|
@ -88,14 +88,16 @@ populate_atm_device() {
|
|||
|
||||
ATMDEV="${ATMDEV:-atm0}"
|
||||
|
||||
WANIFACE="$ATMDEV.1"
|
||||
WANDEV="$ATMDEV.1"
|
||||
|
||||
device_config_exists "$WANIFACE" && return
|
||||
WANIFNAME="$WANIFNAME $WANDEV"
|
||||
|
||||
device_config_exists "$WANDEV" && return
|
||||
|
||||
uci -q set network.atmwan=device
|
||||
uci -q set network.atmwan.type=untagged
|
||||
uci -q set network.atmwan.ifname="$ATMDEV"
|
||||
uci -q set network.atmwan.name="$WANIFACE"
|
||||
uci -q set network.atmwan.name="$WANDEV"
|
||||
}
|
||||
|
||||
populate_ptm_device() {
|
||||
|
|
@ -115,14 +117,16 @@ populate_ptm_device() {
|
|||
|
||||
PTMDEV="${PTMDEV:-ptm0}"
|
||||
|
||||
WANIFACE="$PTMDEV.1"
|
||||
WANDEV="$PTMDEV.1"
|
||||
|
||||
WANIFNAME="$WANIFNAME $WANDEV"
|
||||
|
||||
device_config_exists "$PTMDEV" && return
|
||||
|
||||
uci -q set network.ptmwan=device
|
||||
uci -q set network.ptmwan.type=untagged
|
||||
uci -q set network.ptmwan.ifname="$PTMDEV"
|
||||
uci -q set network.ptmwan.name="$WANIFACE"
|
||||
uci -q set network.ptmwan.name="$WANDEV"
|
||||
}
|
||||
|
||||
populate_eth_device() {
|
||||
|
|
@ -130,14 +134,16 @@ populate_eth_device() {
|
|||
|
||||
ETHDEV="$(db -q get hw.board.ethernetWanPort)"
|
||||
|
||||
WANIFACE="$ETHDEV.1"
|
||||
WANDEV="$ETHDEV.1"
|
||||
|
||||
device_config_exists "$WANIFACE" && return
|
||||
WANIFNAME="$WANIFNAME $WANDEV"
|
||||
|
||||
device_config_exists "$WANDEV" && return
|
||||
|
||||
uci -q set network.ethwan=device
|
||||
uci -q set network.ethwan.type=untagged
|
||||
uci -q set network.ethwan.ifname="$ETHDEV"
|
||||
uci -q set network.ethwan.name="$WANIFACE"
|
||||
uci -q set network.ethwan.name="$WANDEV"
|
||||
}
|
||||
|
||||
populate_network_config_ifnames() {
|
||||
|
|
@ -149,14 +155,12 @@ populate_network_config_ifnames() {
|
|||
return
|
||||
}
|
||||
|
||||
WANTYPE="$(uci -q get network.wan.type)"
|
||||
[ "$WANTYPE" == "anywan" ] && {
|
||||
uci -q delete network.wan.type
|
||||
uci -q set network.wan.ifname="$WANIFACE"
|
||||
uci -q get network.wan.ifname >/dev/null || {
|
||||
uci -q set network.wan.type="anywan"
|
||||
WANIFNAME="$(echo $WANIFNAME | sed -e 's/^ *//')"
|
||||
uci -q set network.wan.ifname="$WANIFNAME"
|
||||
}
|
||||
|
||||
uci -q get network.wan.ifname >/dev/null || uci -q set network.wan.ifname="$WANIFACE"
|
||||
|
||||
uci -q commit network
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue