Xentrk
Part of the Furniture
Thanks for sending the links. You read my mind!If you replace ovpn-up, then you become responsible for doing everything it was previously doing.
asuswrt-merlin.ng/release/src/router/libovpn/openvpn_control.c at master · RMerl/asuswrt-merlin.ng
Third party firmware for Asus routers (newer codebase) - RMerl/asuswrt-merlin.nggithub.com
And also updating resolv.conf/dnsmasq's config:
asuswrt-merlin.ng/release/src/router/rc/openvpn.c at master · RMerl/asuswrt-merlin.ng
Third party firmware for Asus routers (newer codebase) - RMerl/asuswrt-merlin.nggithub.com
I just started exploring if I can also use the openvpn-event script to do my mods since the same parms are being passed. I currently use the "route-up" and "route-pre-down" scripts (e.g. vpnclient1-route-up. I just had time to bounce the vpnclient to see where in the process they are called. One thing I noticed is that the openvpn-event script used to report "-up" (e.g. vpnclient-up) and "-down" being passed in the process. My openvpn-event script would output to system log when these were passed but not script was found to run. But I don't see those two being passed any longer. Did anything change for script type?
#!/bin/sh
###########################################################################################################
# Script: openvpn-event
# VERSION=1.0.2
# Author: John9527, Martineau, Xentrk
# Last Updated Date: 27-June-2020
#
# Description:
# Original Script by John9527:
# https://www.snbforums.com/threads/f...lts-releases-v39e3.18914/page-238#post-294825
#
# Updated Script by John9527
# https://www.snbforums.com/threads/s...pn-port-5060-blocked.41585/page-2#post-352772
#
# Implemented additional patches suggested by Martineau
# https://www.snbforums.com/threads/s...pn-port-5060-blocked.41585/page-2#post-352834
# https://www.snbforums.com/threads/x...swrt-merlin-firmware.57793/page-7#post-520433
#
# Modified by Xentrk for x3mRouting project
############################################################################################################
# shellcheck disable=SC2154
PROJECT_REPO="/jffs/scripts/x3mRouting"
scr_name="$(basename "$0")[$$]"
#Determine Caller
case "$1" in
"tun11")
vpn_name="client1"
;;
"tun12")
vpn_name="client2"
;;
"tun13")
vpn_name="client3"
;;
"tun14")
vpn_name="client4"
;;
"tun15")
vpn_name="client5"
;;
"tun21")
vpn_name="server1"
;;
"tun22")
vpn_name="server2"
;;
*)
vpn_name=""
;;
esac
# Call appropriate script based on script_type
vpn_script_name="vpn$vpn_name-$script_type"
vpn_script_log="/tmp/vpn${vpn_name}_state"
# Check script state
vpn_script_state=$(cat $vpn_script_log 2>/dev/null)
if [ "$vpn_script_name" = "$vpn_script_state" ]; then
echo "VPN script $vpn_script_name already run" | logger -t "$scr_name"
exit 0
fi
# Execute and log script state
if [ -f "$PROJECT_REPO/$vpn_script_name" ]; then
echo "$vpn_script_name" >"$vpn_script_log"
logger -t "$scr_name" "Running $PROJECT_REPO/$vpn_script_name $*"
sh "$PROJECT_REPO/$vpn_script_name" "$*"
else
logger -t "$scr_name" "No scripts found to run for openvpn-event: $vpn_script_name"
echo "${vpn_script_name}-NOSCRIPT" >"$vpn_script_log" # (or nvram set vpn_script_state="${vpn_script_name}-NOSCRIPT"")
exit 0
fi
exit 0
###########################################################################################################
# Script: openvpn-event
# VERSION=1.0.2
# Author: John9527, Martineau, Xentrk
# Last Updated Date: 27-June-2020
#
# Description:
# Original Script by John9527:
# https://www.snbforums.com/threads/f...lts-releases-v39e3.18914/page-238#post-294825
#
# Updated Script by John9527
# https://www.snbforums.com/threads/s...pn-port-5060-blocked.41585/page-2#post-352772
#
# Implemented additional patches suggested by Martineau
# https://www.snbforums.com/threads/s...pn-port-5060-blocked.41585/page-2#post-352834
# https://www.snbforums.com/threads/x...swrt-merlin-firmware.57793/page-7#post-520433
#
# Modified by Xentrk for x3mRouting project
############################################################################################################
# shellcheck disable=SC2154
PROJECT_REPO="/jffs/scripts/x3mRouting"
scr_name="$(basename "$0")[$$]"
#Determine Caller
case "$1" in
"tun11")
vpn_name="client1"
;;
"tun12")
vpn_name="client2"
;;
"tun13")
vpn_name="client3"
;;
"tun14")
vpn_name="client4"
;;
"tun15")
vpn_name="client5"
;;
"tun21")
vpn_name="server1"
;;
"tun22")
vpn_name="server2"
;;
*)
vpn_name=""
;;
esac
# Call appropriate script based on script_type
vpn_script_name="vpn$vpn_name-$script_type"
vpn_script_log="/tmp/vpn${vpn_name}_state"
# Check script state
vpn_script_state=$(cat $vpn_script_log 2>/dev/null)
if [ "$vpn_script_name" = "$vpn_script_state" ]; then
echo "VPN script $vpn_script_name already run" | logger -t "$scr_name"
exit 0
fi
# Execute and log script state
if [ -f "$PROJECT_REPO/$vpn_script_name" ]; then
echo "$vpn_script_name" >"$vpn_script_log"
logger -t "$scr_name" "Running $PROJECT_REPO/$vpn_script_name $*"
sh "$PROJECT_REPO/$vpn_script_name" "$*"
else
logger -t "$scr_name" "No scripts found to run for openvpn-event: $vpn_script_name"
echo "${vpn_script_name}-NOSCRIPT" >"$vpn_script_log" # (or nvram set vpn_script_state="${vpn_script_name}-NOSCRIPT"")
exit 0
fi
exit 0