E
ebug mode enabledOption ==> loadmodules
+ printf %s loadmodules
+ sed s/^[ \t]*//;s/[ \t]*$//
+ menu1=loadmodules
+ Validate_User_Choice loadmodules
+ local menu1=loadmodules
+ [ Y == Y ]
+ echo loadmodules
+ menu1=loadmodules
+ Process_User_Choice loadmodules
+ local menu1=loadmodules
+ Load_UserspaceTool
+ local USE_ENTWARE_KERNEL_MODULE=N
+ [ -f /jffs/addons/wireguard/WireguardVPN.conf ]
+ grep -oE ^USE_ENTWARE_KERNEL_MODULE /jffs/addons/wireguard/WireguardVPN.conf
+ [ -n USE_ENTWARE_KERNEL_MODULE ]
+ local USE_ENTWARE_KERNEL_MODULE=Y
+ [ ! -d /jffs/addons/wireguard/ ]
+ + sort -r
+ tr \n
wg show interfaces
+ tr \n
+ echo wg21
+ local ACTIVE_WG_INTERFACES=wg21
+ local STATUS=0
+ [ ! -f /usr/sbin/wg ]
+ [ Y == Y ]
+ echo -e \e[96m\n\tLoading WireGuard Kernel module and Userspace Tool for RT-AX88U (v386.7_0)\e[0m
Loading WireGuard Kernel module and Userspace Tool for RT-AX88U (v386.7_0)
+ ls /jffs/addons/wireguard/wireguard-kernel_1.0.20211208-RT-AX88U_2_aarch64-3.10.ipk /jffs/addons/wireguard/wireguard-tools_1.0.20210914-1_aarch64-3.10.ipk
+ [ -n /jffs/addons/wireguard/wireguard-kernel_1.0.20211208-RT-AX88U_2_aarch64-3.10.ipk
/jffs/addons/wireguard/wireguard-tools_1.0.20210914-1_aarch64-3.10.ipk ]
+ [ -n wg21 ]
+ Manage_Wireguard_Sessions stop wg21
+ local ACTION=stop
+ shift
+ local WG_INTERFACE=wg21
+ shift
+ local CATEGORY=
+ local SHOWCMDS=
+ local WG_QUICK=
+ [ -z wg21 ]
+ [ wg21 == all ]
+ echo -en \e[96m
+ local PEERS=wg21
+ [ wg21 == debug ]
+ [ wg21 == wg-quick ]
+ [ wg21 == policy ]
+ [ wg21 == nopolicy ]
+ [ wg != wg ]
+ local INTERFACES= wg21
+ WG_INTERFACE= wg21
+ printf %s wg21
+ + sed s/wgs[1-5]//gsed
s/wgc[1-5]//g
+ sed s/^[ \t]*//;s/[ \t]*$//
+ WG_INTERFACE=wg21
+ local TMP_SERVERS=
+ local TMP_CLIENTS=
+ echo
+ grep -w wg21
+ [ -z ]
+ TMP_SERVERS= wg21
+ echo wg21+ tr \n
+ sort
+ tr \n
+ local TMP_SERVERS= wg21
+ WG_INTERFACE= wg21
+ echo wg21
+ awk {$1=$1};1
+ WG_INTERFACE=wg21
+ [ -n wg21 ]
+ echo -e \e[97m\n\tRequesting WireGuard VPN Peer stop (\e[95mwg21\e[0m) \e[41m\e[0m
Requesting WireGuard VPN Peer stop (wg21)
+ [ -z wg21 ]
+ echo -e
+ [ wg21 == debug ]
+ wg show wg21
+ [ -n interface: wg21
public key: tvegMrMUlXUbSnJsE8EQq5LaIv4m28LUb81Zg9bKKyM=
private key: (hidden)
listening port: 51820
peer: Z44NfqUinwaCC43HzzbtsdHP+vaVUl/KG9T+wPUJCmc=
preshared key: (hidden)
allowed ips: 10.50.1.2/32 ]
+ Server_or_Client wg21
+ local WG_INTERFACE=wg21
+ local PEER_TYPE=**ERROR**
+ local SOURCE_DIR=/opt/etc/wireguard.d/
+ [ -n ]
+ [ **ERROR** == **ERROR** ]
+ sqlite3 /opt/etc/wireguard.d/WireGuard.db SELECT peer FROM servers WHERE peer='wg21';
+ [ -n wg21 ]
+ local PEER_TYPE=server
+ [ server == **ERROR** ]
+ [ server == **ERROR** ]
+ [ server == **ERROR** ]
+ echo server
+ Mode=server
+ [ server == server ]
+ local TABLE=servers
+ wg show wg21
+ grep -F interface:
+ [ -n interface: wg21 ]
+ [ ! -f /opt/etc/wireguard.d/wg21.conf ]
+ sqlite3 /opt/etc/wireguard.d/WireGuard.db SELECT tag FROM servers WHERE peer='wg21';
+ local DESC=# RT-AX88U Server #1
+ echo -en \e[96m
+ SayT v4.16 Requesting termination of WireGuard VPN 'server' Peer ('wg21')
+ echo -e 6746 v4.16 Requesting termination of WireGuard VPN 'server' Peer ('wg21')
+ basename /jffs/addons/wireguard/wg_manager.sh
+ logger -t (wg_manager.sh)
+ wg show interfaces
+ grep -w wg21
+ [ -z wg21 ]
+ [ server == server ]
+ awk /^PublicKey/ {print $3} /opt/etc/wireguard.d/wg21.conf
+ tr \n
+ local DEVICE_PUB_KEYS=Z44NfqUinwaCC43HzzbtsdHP+vaVUl/KG9T+wPUJCmc=
+ date +%s
+ local TIMESTAMP=1656307136
+ sqlite3 /opt/etc/wireguard.d/WireGuard.db SELECT name FROM devices WHERE pubkey='Z44NfqUinwaCC43HzzbtsdHP+vaVUl/KG9T+wPUJCmc=';
+ DEVICE=5T
+ sqlite3 /opt/etc/wireguard.d/WireGuard.db INSERT into session values('5T','End','1656307136');
+ /jffs/addons/wireguard/wg_server wg21 disable
WireGuard-serverwg21: WireGuard VPN 'Server' Peer (wg21) on 10.50.1.1:51820 (# RT-AX88U Server #1) Terminated
+ wg show interfaces
+ + grep wg2[1-9]
tr + wc -w
\n
+ [ 0 -eq 0 ]
+ Manage_UDP_Monitor server disable
+ local TYPE=server
+ local ACTION=disable
+ local WATCH=
+ [ -z ]
+ WATCH=&
+ date +%Y%m%d-%H%M%S
+ local TS=20220627-021857
+ [ -n disable ]
+ [ disable == disable ]
+ pidof conntrack
+ killall
+ pidof UDP_Monitor.sh
+ killall
+ pidof UDP_Updater.sh
+ killall
+ rm /tmp/UDP_Updater.pid
+ rm /tmp/UDP_Monitor.pid
+ rm /tmp/WireGuard_UDP.log
+ rm /jffs/addons/wireguard/UDP_Monitor.sh
+ pidof UDP_Monitor.sh
+ [ -n ]
+ pidof UDP_Updater.sh
+ [ -n ]
+ echo -e N
+ local UDP_MONITOR=N
+ WG_show
+ local SHOW=
+ [ == Y ]
+ ls /jffs/addons/wireguard/wireguard-kernel_1.0.20211208-RT-AX88U_2_aarch64-3.10.ipk /jffs/addons/wireguard/wireguard-tools_1.0.20210914-1_aarch64-3.10.ipk
+ + basenamesed /jffs/addons/wireguard/wireguard-kernel_1.0.20211208-RT-AX88U_2_aarch64-3.10.ipk
s/_.*$//
+ echo wireguard-kernel_1.0.20211208-RT-AX88U_2_aarch64-3.10.ipk
+ local MODULE_NAME=wireguard-kernel
+ SayT Initialising WireGuard module 'wireguard-kernel'
+ echo -e 6746 Initialising WireGuard module 'wireguard-kernel'
+ basename /jffs/addons/wireguard/wg_manager.sh
+ logger -t (wg_manager.sh)
+ echo -e \e[96m\tInitialising WireGuard module \e[0m'wireguard-kernel'
Initialising WireGuard module 'wireguard-kernel'
+ opkg install /jffs/addons/wireguard/wireguard-kernel_1.0.20211208-RT-AX88U_2_aarch64-3.10.ipk
Package wireguard-kernel (1.0.20211208-k51_1) installed in root is up to date.
+ [ 0 -eq 0 ]
+ md5sum /jffs/addons/wireguard/wireguard-kernel_1.0.20211208-RT-AX88U_2_aarch64-3.10.ipk
+ sed -i s~/jffs/addons/wireguard/~~ /jffs/addons/wireguard/wireguard-kernel.md5
+ + basename /jffs/addons/wireguard/wireguard-tools_1.0.20210914-1_aarch64-3.10.ipk
sed s/_.*$//
+ echo wireguard-tools_1.0.20210914-1_aarch64-3.10.ipk
+ local MODULE_NAME=wireguard-tools
+ SayT Initialising WireGuard module 'wireguard-tools'
+ echo -e 6746 Initialising WireGuard module 'wireguard-tools'
+ basename /jffs/addons/wireguard/wg_manager.sh
+ logger -t (wg_manager.sh)
+ echo -e \e[96m\tInitialising WireGuard module \e[0m'wireguard-tools'
Initialising WireGuard module 'wireguard-tools'
+ opkg install /jffs/addons/wireguard/wireguard-tools_1.0.20210914-1_aarch64-3.10.ipk
Package wireguard-tools (1.0.20210914-1) installed in root is up to date.
+ [ 0 -eq 0 ]
+ md5sum /jffs/addons/wireguard/wireguard-tools_1.0.20210914-1_aarch64-3.10.ipk
+ sed -i s~/jffs/addons/wireguard/~~ /jffs/addons/wireguard/wireguard-tools.md5
+ [ 0 -eq 0 ]
+ insmod /opt/lib/modules/wireguard
+ dmesg
+ grep -a WireGuard
+ tail -n 1
+ echo -e \e[90m\twireguard: WireGuard 1.0.20211208 loaded. See
www.wireguard.com for information.
wireguard: WireGuard 1.0.20211208 loaded. See
www.wireguard.com for information.
+ dmesg
+ grep -a wireguard: Copyright
+ tail -n 1
+ echo -e \e[90m\twireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <
Jason@zx2c4.com>. All Rights Reserved.\n\e[0m
wireguard: Copyright (C) 2015-2019 Jason A. Donenfeld <
Jason@zx2c4.com>. All Rights Reserved.
+ local STATUS=0
+ [ -n wg21 ]
+ Manage_Wireguard_Sessions start wg21
+ local ACTION=start
+ shift
+ local WG_INTERFACE=wg21
+ shift
+ local CATEGORY=
+ local SHOWCMDS=
+ local WG_QUICK=
+ [ -z wg21 ]
+ [ wg21 == all ]
+ echo -en \e[96m
+ local PEERS=wg21
+ [ wg21 == debug ]
+ [ wg21 == wg-quick ]
+ [ wg21 == policy ]
+ [ wg21 == nopolicy ]
+ [ wg != wg ]
+ local INTERFACES= wg21
+ WG_INTERFACE= wg21
+ printf %s wg21
+ sed s/wgs[1-5]//g
+ + sed s/^[ \t]*//;s/[ \t]*$//
sed s/wgc[1-5]//g
+ WG_INTERFACE=wg21
+ local TMP_SERVERS=
+ local TMP_CLIENTS=
+ echo
+ grep -w wg21
+ [ -z ]
+ TMP_SERVERS= wg21
+ echo wg21
+ tr \n
+ sort
+ tr \n
+ local TMP_SERVERS= wg21
+ WG_INTERFACE= wg21
+ echo wg21
+ awk {$1=$1};1
+ WG_INTERFACE=wg21
+ [ -n wg21 ]
+ echo -e \e[97m\n\tRequesting WireGuard VPN Peer start (\e[95mwg21\e[0m) \e[41m\e[0m
Requesting WireGuard VPN Peer start (wg21)
+ echo
+ grep -w nopolicy
+ [ -n ]
+ echo -e
+ LOOKAHEAD=wg21
+ Server_or_Client wg21
+ local WG_INTERFACE=wg21
+ local PEER_TYPE=**ERROR**
+ local SOURCE_DIR=/opt/etc/wireguard.d/
+ [ -n ]
+ [ **ERROR** == **ERROR** ]
+ sqlite3 /opt/etc/wireguard.d/WireGuard.db SELECT peer FROM servers WHERE peer='wg21';
+ [ -n wg21 ]
+ local PEER_TYPE=server
+ [ server == **ERROR** ]
+ [ server == **ERROR** ]
+ [ server == **ERROR** ]
+ echo server
+ Mode=server
+ [ server == server ]
+ local TABLE=servers
+ [ -z ]
+ [ server == client ]
+ [ start == restart ]
+ echo -en \e[96m
+ SayT v4.16 Initialising Wireguard VPN 'server' Peer (wg21)
+ echo -e 6746 v4.16 Initialising Wireguard VPN 'server' Peer (wg21)
+ basename /jffs/addons/wireguard/wg_manager.sh
+ logger -t (wg_manager.sh)
+ ifconfig
+ grep -E ^wg21
+ [ -n ]
+ [ -f /opt/etc/wireguard.d/wg21.conf ]
+ [ server == server ]
+ date +%s
+ local TS=1656307137
+ chmod +x /jffs/addons/wireguard/wg_server
+ /jffs/addons/wireguard/wg_server wg21
WireGuard-serverwg21: Initialising WireGuard VPN 'Server' Peer (wg21) on 10.50.1.1:51820 (# RT-AX88U Server #1)
WireGuard-serverwg21: Initialisation complete.
+ awk /^PublicKey/ {print $3} /opt/etc/wireguard.d/wg21.conf
+ tr \n
+ local DEVICE_PUB_KEYS=Z44NfqUinwaCC43HzzbtsdHP+vaVUl/KG9T+wPUJCmc=
+ date +%s
+ local TIMESTAMP=1656307138
+ sqlite3 /opt/etc/wireguard.d/WireGuard.db SELECT name FROM devices WHERE pubkey='Z44NfqUinwaCC43HzzbtsdHP+vaVUl/KG9T+wPUJCmc=';
+ DEVICE=5T
+ sqlite3 /opt/etc/wireguard.d/WireGuard.db INSERT into session values('5T','Start','1656307138');
+ sqlite3 /opt/etc/wireguard.d/WireGuard.db UPDATE devices SET conntrack='1656307138' WHERE name='5T';
+ Route=
+ local FORCEPOLICY=
+ local POLICY_MODE=
+ WG_show
+ local SHOW=
+ [ == Y ]
+ return 0
+ set +x