- First commit of the new version!

This commit is contained in:
2025-06-23 11:34:42 +02:00
parent 218b34a909
commit 7efd2f514c
5 changed files with 1922 additions and 800 deletions

181
usr/local/sbin/rx3_net_adm Executable file
View File

@@ -0,0 +1,181 @@
#!/bin/bash
RETVAL=0
prog="rx3-net"
#DEBUG=""
DEBUG="echo"
#DEBUG=":"
LOG=":"
#LOG="echo"
# Includes
#-----------------------------------------------------------------------------------------------------------------------------------
. /usr/local/lib/network.bash
# Some functions to make the below more readable
#--------------------------------------------------------------------------------------------------------------------------
# Rx3-Start
#--------------------------------------------------------------------------------------------------------------------------
rx3-start()
{
network_table_init
network_forward_start
}
#--------------------------------------------------------------------------------------------------------------------------
# Rx3-Stop
#--------------------------------------------------------------------------------------------------------------------------
rx3-stop()
{
network_forward_stop
network_table_deinit
return 0
}
#--------------------------------------------------------------------------------------------------------------------------
# Start
#--------------------------------------------------------------------------------------------------------------------------
start()
{
echo "Starting..."
if [ -r /var/lock/subsys/rx3-net ]
then
echo "already started"
RETVAL=0
else
rx3-start
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/rx3-net
fi
echo
}
#--------------------------------------------------------------------------------------------------------------------------
# Stop
#--------------------------------------------------------------------------------------------------------------------------
stop()
{
echo "Stopping..."
if [ -r /var/lock/subsys/rx3-net ]
then
rx3-stop
RETVAL=$?
else
echo "already stopped"
RETVAL=0
fi
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/rx3-net
echo
}
#--------------------------------------------------------------------------------------------------------------------------
# Status
#--------------------------------------------------------------------------------------------------------------------------
status()
{
network_status
}
#--------------------------------------------------------------------------------------------------------------------------
# Dump
#--------------------------------------------------------------------------------------------------------------------------
dump()
{
network_tab_dump
}
#--------------------------------------------------------------------------------------------------------------------------
# Table-Set ()
#--------------------------------------------------------------------------------------------------------------------------
table_set()
{
echo "Setting ip:$1 table:$2"
network_table_set $1 $2
}
#--------------------------------------------------------------------------------------------------------------------------
# Main
#--------------------------------------------------------------------------------------------------------------------------
network_tab_load
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 1
start
;;
status)
status
;;
dump)
dump
;;
table_set)
table_set $2 $3
;;
*)
echo "Usage: $0 {start|stop|restart|status|dump|table_set}"
RETVAL=1
;;
esac
exit $RETVAL