1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-14 19:41:51 +00:00

Fix network configuration for WRT devices

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-07-15 14:41:09 +02:00
parent 0188d1d02c
commit 8ce202c75c

View file

@ -82,6 +82,8 @@ fi
lanif="eth0"
if [ -d /sys/class/net/lan0 -o -n "$(ip link | grep ' lan0')" ] && [ -d /sys/class/net/wan -o -n "$(ip link | grep ' wan@')" -o -n "$(ip link | grep ' wan:')" ]; then
lanif="wan"
elif [ -d /sys/class/net/lan1 -o -n "$(ip link | grep ' lan1')" ] && [ -d /sys/class/net/wan -o -n "$(ip link | grep ' wan@')" -o -n "$(ip link | grep ' wan:')" ]; then
lanif="wan"
elif [ -d /sys/class/net/lan ] || [ -n "$(ip link | grep ' lan')" ]; then
lanif="lan"
elif [ "$(swconfig list 2>&1 | grep switch0)" != "" ]; then
@ -186,6 +188,24 @@ if [ "$(uci -q show network.wan1 | grep multipath)" = "" ] && [ "$(uci -q show m
_setup_macaddr "wan4" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}"
fi
fi
elif [ -d /sys/class/net/lan1 -o -n "$(ip link | grep ' lan1')" ] && [ -d /sys/class/net/lan2 -o -n "$(ip link | grep ' lan2')" ]; then
_setup_wan_interface wan1 lan1 master
_setup_wan_interface wan2 lan2 on
_macaddr=$(uci -q get "network.lan1.macaddr")
_setup_macaddr "wan1" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}"
_macaddr=$(uci -q get "network.lan2.macaddr")
_setup_macaddr "wan2" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}"
if [ -d /sys/class/net/lan3 ] || [ -n "$(ip link | grep ' lan3')" ]; then
_setup_wan_interface wan3 lan3 on
_macaddr=$(uci -q get "network.lan3.macaddr")
_setup_macaddr "wan3" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}"
if [ -d /sys/class/net/lan4 ] || [ -n "$(ip link | grep ' lan4')" ]; then
_setup_wan_interface wan4 lan4 on
_macaddr=$(uci -q get "network.lan4.macaddr")
_setup_macaddr "wan4" "${_macaddr:-$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/' -e 's/^\(.\)[13579bdf]/\10/')}"
fi
fi
else
_setup_wan_interface wan1 wan master macvlan
_setup_wan_interface wan2 wan on macvlan