1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2025-01-17 19:11:22 +08:00 committed by GitHub
commit b71b4eba83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 1 deletions

View file

@ -65,6 +65,7 @@ _setup_wan_interface() {
set network.$1.defaultroute=0
set network.$1.delegate=0
set network.$1.addlatency=0
delete network.$1.ifname
set network.${1}_dev=device
set network.${1}_dev.name=$2
set network.${1}_dev.txqueuelen=1000
@ -195,6 +196,9 @@ set network.lan.delegate=0
set network.lan.addlatency=0
set network.lan.txqueuelen=2000
set dhcp.lan.dhcpv4='server'
set network.lan_dev=device
set network.lan_dev.name=${lanif}
EOF
uci -q batch <<-EOF
@ -291,6 +295,11 @@ if [ "$(uci -q show network.wan1 | grep multipath)" = "" ] && [ -z "$(uci -q get
_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/')}"
if [ -d /sys/class/net/lan5 ] || [ -n "$(ip link | grep ' lan5')" ]; then
_setup_wan_interface wan5 lan5 on
_macaddr=$(uci -q get "network.lan5.macaddr")
_setup_macaddr "wan5" "${_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
fi
else

View file

@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2013 OpenWrt.org
# Copyright (C) 2023 Yannick Chabanois (Ycarus) for OpenMPTCProuter
# Copyright (C) 2023-2025 Yannick Chabanois (Ycarus) for OpenMPTCProuter
START=00
USE_PROCD=1
@ -48,7 +48,22 @@ modem1()
else
gpioset -t0 modem1=1
fi
if [ -n "$(uci -q get network.modem1)" ] && [ -z "$(uci -q get network.modem1.device)" ]; then
sleep 20
if [ -e /sys/devices/platform/soc/11200000.usb/usb1/1-1/1-1.1 ]; then
uci -q batch <<-EOF
set network.modem1.device='/sys/devices/platform/soc/11200000.usb/usb1/1-1/1-1.1'
commit network
EOF
elif [ -e /sys/devices/platform/soc/11200000.usb/usb2/2-1/2-1.1 ]; then
uci -q batch <<-EOF
set network.modem1.device='/sys/devices/platform/soc/11200000.usb/usb2/2-1/2-1.1'
commit network
EOF
fi
fi
}
modem2()
{
# sim 2
@ -88,7 +103,22 @@ modem2()
else
gpioset -t0 modem2=1
fi
if [ -n "$(uci -q get network.modem2)" ] && [ -z "$(uci -q get network.modem2.device)" ]; then
sleep 20
if [ -e /sys/devices/platform/soc/11200000.usb/usb1/1-1/1-1.2 ]; then
uci -q batch <<-EOF
set network.modem2.device='/sys/devices/platform/soc/11200000.usb/usb1/1-1/1-1.2'
commit network
EOF
elif [ -e /sys/devices/platform/soc/11200000.usb/usb2/2-1/2-1.2 ]; then
uci -q batch <<-EOF
set network.modem2.device='/sys/devices/platform/soc/11200000.usb/usb2/2-1/2-1.2'
commit network
EOF
fi
fi
}
start_service()
{
modem="$1"