aboutsummaryrefslogtreecommitdiff
path: root/net/mwan3/files
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2021-07-05 16:15:02 +0200
committerFlorian Eckert <fe@dev.tdt.de>2021-07-08 09:07:52 +0200
commit619b721c2f9b0b1c88f9fde7da75c9e37a060a47 (patch)
tree5e686ed91115125dc4281aca0820428ef8f2fff2 /net/mwan3/files
parenta9dac71e3d7f2d46f7d051cb8ffe235c49177848 (diff)
mwan3: add troublshoot command from LuCI
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'net/mwan3/files')
-rwxr-xr-xnet/mwan3/files/usr/sbin/mwan389
1 files changed, 88 insertions, 1 deletions
diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3
index 0bb26b2ea..1ba6004bb 100755
--- a/net/mwan3/files/usr/sbin/mwan3
+++ b/net/mwan3/files/usr/sbin/mwan3
@@ -30,6 +30,7 @@ EOF
command_help "connected" "Show directly connected networks"
command_help "rules" "Show active rules"
command_help "status" "Show all status"
+ command_help "internal <ipv4|ipv6>" "Show internal configuration <default: ipv4>"
command_help "use <iface> <cmd>" "Run a command bound to <iface> and avoid mwan3 rules"
}
@@ -113,6 +114,92 @@ status()
rules
}
+internal()
+{
+ local family="$1"
+ local dash="-------------------------------------------------"
+
+ if [ -f "/etc/openwrt_release" ]; then
+ . /etc/openwrt_release
+ fi
+
+ local ipt ip output
+
+ if [ "$family" = "ipv6" ]; then
+ ipt="$IPT6"
+ ip="$IP6"
+ else
+ ipt="$IPT4"
+ ip="$IP4"
+ fi
+
+ echo "Software-Version"
+ echo "$dash"
+
+ if [ "$DISTRIB_RELEASE" != "" ]; then
+ echo "OpenWrt - $DISTRIB_RELEASE"
+ else
+ echo "OpenWrt - unknown"
+ fi
+
+ echo ""
+ echo "Output of \"$ip a show\""
+ echo "$dash"
+ output="$($ip a show)"
+ if [ "$output" != "" ]; then
+ echo "$output"
+ else
+ echo "No data found"
+ fi
+
+ echo ""
+ echo "Output of \"$ip route show\""
+ echo "$dash"
+ output="$($ip route show)"
+ if [ "$output" != "" ]; then
+ echo "$output"
+ else
+ echo "No data found"
+ fi
+
+ echo ""
+ echo "Output of \"$ip rule show\""
+ echo "$dash"
+ output="$($ip rule show)"
+ if [ "$output" != "" ]; then
+ echo "$output"
+ else
+ echo "No data found"
+ fi
+
+ echo ""
+ echo "Output of \"$ip route list table 1-250\""
+ echo "$dash"
+ local dump=0
+ for i in $(seq 1 250); do
+ output=$($ip route list table $i 2>/dev/null)
+ if [ "$output" != "" ];then
+ dump=1
+ echo "Routing table $i:"
+ echo "$output"
+ echo ""
+ fi
+ done
+ if [ "$dump" = "0" ]; then
+ echo "No data found"
+ echo ""
+ fi
+
+ echo "Output of \"$ipt -L -v -n\""
+ echo "$dash"
+ output="$($ipt -L -v -n)"
+ if [ "$output" != "" ]; then
+ echo "$output"
+ else
+ echo "No data found"
+ fi
+}
+
start() {
/etc/init.d/mwan3 enable
/etc/init.d/mwan3 start
@@ -154,7 +241,7 @@ use() {
}
case "$1" in
- ifup|ifdown|interfaces|policies|connected|rules|status|start|stop|restart|use)
+ ifup|ifdown|interfaces|policies|connected|rules|status|start|stop|restart|use|internal)
mwan3_init
# shellcheck disable=SC2048
$*