1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update openmptcprouter script and config to use device setting instead of ifname

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-06-25 19:48:43 +02:00
parent c5945ec683
commit ea3a4840c4
7 changed files with 33 additions and 31 deletions

View file

@ -11,7 +11,7 @@ _setup_macvlan() {
# do not create macvlan for vlan
local _ifname
_ifname=$(uci -q get "network.$1.ifname")
_ifname=$(uci -q get "network.$1.device")
case "$_ifname" in
eth*.*) return ;;
esac
@ -21,26 +21,24 @@ _setup_macvlan() {
set network.$1_dev.name=$1
set network.$1_dev.type=macvlan
set network.$1_dev.ifname=$_ifname
set network.$1.ifname=$1
set network.$1_dev.mode='vepa'
set network.$1.device=$1
set network.$1.type=macvlan
set network.$1.masterintf=$_ifname
set macvlan.$1=macvlan
set macvlan.$1.name=$1
set macvlan.$1.ifname=$_ifname
EOF
_macaddr=$(uci -q get "network.$1.macaddr")
_setup_macaddr "$1_dev" "${_macaddr:-auto$(date +%s)}"
}
_setup_macvlan_update() {
uci -q get "network.$1_dev.ifname" >/dev/null || return
uci -q batch <<-EOF
set macvlan.$1=macvlan
set macvlan.$1.ifname=$_ifname
commit macvlan
EOF
}
#_setup_macvlan_update() {
# uci -q get "network.$1_dev.device" >/dev/null || return
#
# uci -q batch <<-EOF
# set macvlan.$1=macvlan
# set macvlan.$1.device=$_ifname
# commit macvlan
# EOF
#}
_setup_mptcp_handover_to_on() {
if [ "$(uci -q get network.$1.multipath)" = "handover" ]; then
@ -59,7 +57,7 @@ _setup_multipath_off() {
_setup_wan_interface() {
uci -q batch <<-EOF
set network.$1=interface
set network.$1.ifname=$2
set network.$1.device=$2
set network.$1.proto=static
set network.$1.ip4table=wan
set network.$1.multipath=$3
@ -72,7 +70,7 @@ _setup_wan_interface() {
}
config_load network
config_foreach _setup_macvlan_update interface
#config_foreach _setup_macvlan_update interface
config_foreach _setup_mptcp_handover_to_on interface
if [ "$(uci -q show network.lan | grep multipath)" != "" ]; then
@ -128,7 +126,7 @@ set network.lan=interface
set network.lan.proto=static
set network.lan.ipaddr=192.168.100.1
set network.lan.netmask=255.255.255.0
set network.lan.ifname=${lanif}
set network.lan.device=${lanif}
set network.lan.metric=2048
set network.lan.ipv6=0
set network.lan.delegate=0
@ -295,6 +293,10 @@ fi
# Replace omrip to oip in config for old config
sed -i 's/omrip/oip/g' /etc/config/*
# Fix config from ifname to device for loopback
uci -q delete network.loopback.ifname
uci -q set network.loopback.device='lo'
uci -q commit macvlan
uci -q commit network
rm -f /tmp/luci-indexcache