Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
openvpn: fix skipping of empty rule; added logging of openvpn-event l…
Browse files Browse the repository at this point in the history
…aunches
  • Loading branch information
RMerl committed May 9, 2015
1 parent 059f877 commit 8717961
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions release/src/router/others/updown.sh
Expand Up @@ -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
14 changes: 8 additions & 6 deletions release/src/router/others/vpnrouting.sh
@@ -1,18 +1,20 @@
#!/bin/sh

PARAM=$*

create_client_list(){
WAN_PRIO=1000
VPN_PRIO=1200
IFS="<"

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))
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8717961

Please sign in to comment.