From 871796151cc6b692a1c424fbd9be1d93f6ad66f2 Mon Sep 17 00:00:00 2001 From: Eric Sauvageau Date: Fri, 8 May 2015 22:41:15 -0400 Subject: [PATCH] openvpn: fix skipping of empty rule; added logging of openvpn-event launches --- release/src/router/others/updown.sh | 1 + release/src/router/others/vpnrouting.sh | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/release/src/router/others/updown.sh b/release/src/router/others/updown.sh index e51b491d635..59512a652de 100644 --- a/release/src/router/others/updown.sh +++ b/release/src/router/others/updown.sh @@ -35,6 +35,7 @@ rmdir /etc/openvpn if [ -f /jffs/scripts/openvpn-event ] then + logger -t "custom script" "Running /jffs/scripts/openvpn-event (args: $*)" sh /jffs/scripts/openvpn-event $* fi exit 0 diff --git a/release/src/router/others/vpnrouting.sh b/release/src/router/others/vpnrouting.sh index 3190e27b2aa..11733fc005c 100755 --- a/release/src/router/others/vpnrouting.sh +++ b/release/src/router/others/vpnrouting.sh @@ -1,5 +1,7 @@ #!/bin/sh +PARAM=$* + create_client_list(){ WAN_PRIO=1000 VPN_PRIO=1200 @@ -7,12 +9,12 @@ create_client_list(){ for ENTRY in $VPN_IP_LIST do - if [ $ENTRY = "" ] + if [ "$ENTRY" = "" ] then continue fi TARGET_ROUTE=$(echo $ENTRY | cut -d ">" -f 4) - if [ $TARGET_ROUTE = "WAN" ] + if [ "$TARGET_ROUTE" = "WAN" ] then TARGET_LOOKUP="main" WAN_PRIO=$((WAN_PRIO+1)) @@ -25,7 +27,7 @@ create_client_list(){ TARGET_NAME="VPN" fi VPN_IP=$(echo $ENTRY | cut -d ">" -f 2) - if [ $VPN_IP != "0.0.0.0" ] + if [ "$VPN_IP" != "0.0.0.0" ] then SRCC="from" SRCA="$VPN_IP" @@ -34,7 +36,7 @@ create_client_list(){ SRCA="" fi DST_IP=$(echo $ENTRY | cut -d ">" -f 3) - if [ $DST_IP != "0.0.0.0" ] + if [ "$DST_IP" != "0.0.0.0" ] then DSTC="to" DSTA="$DST_IP" @@ -66,12 +68,12 @@ purge_client_list(){ run_custom_script(){ if [ -f /jffs/scripts/openvpn-event ] then - sh /jffs/scripts/openvpn-event $* + logger -t "custom script" "Running /jffs/scripts/openvpn-event (args: $PARAM)" + sh /jffs/scripts/openvpn-event $PARAM fi } - if [ "$dev" == "tun11" ] then VPN_IP_LIST=$(nvram get vpn_client1_clientlist)