2024-07-04 08:46:32 +00:00
|
|
|
#!/bin/sh
|
2024-08-30 15:02:31 +00:00
|
|
|
#
|
2025-01-17 11:47:52 +00:00
|
|
|
# Copyright (C) 2018-2025 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
2024-08-30 15:02:31 +00:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2025-01-17 11:47:52 +00:00
|
|
|
# This script check if MPTCP status is correct on interface and if modems are correctly set on z8102ax
|
2024-06-28 12:20:55 +00:00
|
|
|
|
|
|
|
# Set default multipath status
|
2024-07-04 08:46:32 +00:00
|
|
|
[ "$OMR_TRACKER_INTERFACE" = "omrvpn" ] && multipath "$OMR_TRACKER_DEVICE" off >/dev/null 2>&1
|
|
|
|
[ "$OMR_TRACKER_INTERFACE" = "omr6in4" ] && multipath "$OMR_TRACKER_DEVICE" off >/dev/null 2>&1
|
2024-06-28 12:20:55 +00:00
|
|
|
|
|
|
|
if [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$OMR_TRACKER_INTERFACE" != "omrvpn" ] && [ "$OMR_TRACKER_INTERFACE" != "omr6in4" ]; then
|
2024-07-05 14:02:36 +00:00
|
|
|
if [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.disabled)" = "1" ]; then
|
2024-07-26 10:05:41 +00:00
|
|
|
_log "Disable MPTCP & Tracker on the disabled interface $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE)"
|
2024-11-28 14:51:03 +00:00
|
|
|
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" >/dev/null 2>&1
|
|
|
|
/etc/init.d/omr-tracker restart >/dev/null 2>&1
|
2024-06-28 12:20:55 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
2024-07-05 14:02:36 +00:00
|
|
|
metric="$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)"
|
|
|
|
if [ -z "$metric" ] || { [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -z "$(ip route show table $metric | grep $OMR_TRACKER_DEVICE)" ]; } || { [ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -z "$(ip -6 route show table 6${metric} | grep $OMR_TRACKER_DEVICE)" ]; }; then
|
|
|
|
_log "Routes not correctly set for $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE table $metric) with IPs $OMR_TRACKER_DEVICE_IP $OMR_TRACKER_DEVICE_IP6"
|
2024-11-28 14:51:03 +00:00
|
|
|
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" >/dev/null 2>&1
|
|
|
|
_log "Restart OMR-Tracker"
|
|
|
|
/etc/init.d/omr-tracker restart >/dev/null 2>&1
|
2024-07-04 08:46:32 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
2024-06-28 12:20:55 +00:00
|
|
|
fi
|
2025-01-17 11:47:52 +00:00
|
|
|
|
|
|
|
if [ -n "$(grep z8102ax /etc/board.json)" ]; then
|
|
|
|
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'
|
|
|
|
set network.modem2.device='/sys/devices/platform/soc/11200000.usb/usb1/1-1/1-1.2'
|
|
|
|
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'
|
|
|
|
set network.modem2.device='/sys/devices/platform/soc/11200000.usb/usb2/2-1/2-1.2'
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
[ -n "$(uci -q changes network)" ] && uci -q commit network
|
|
|
|
fi
|