<snip>
case "$LINE" in
ifconfig-push* | staticip* )
Parse "$LINE" " " KEYWORD IP_ADDR SUBNET_MASK
# Let's give the lazy/numpty user a helping hand!
# e.g. 'staticip 88' -> 'ifconfig-push ${POOL_SUBNET}.88 255.255.255.0'
#
#logger -st "($(basename $0))" $$ "***DEBUG KEYWORD="$KEYWORD
case "$KEYWORD" in
ifconfig-push | staticip) # IPv4......
if [ "$KEYWORD" == "staticip" ];then # My psuedo OpenVPN server directive
KEYWORD="ifconfig-push" # Use real OpenVPN IPv4 statement rather than our 'staticip' codeword
logger -st "($(basename $0))" $$ "Psuedo command 'staticip' converted to 'ifconfig-push'!"
fi
if [ -z "$SUBNET_MASK" ];then
SUBNET_MASK="255.255.255.0" # IPv4 ONLY! - Use the default subnet mask if ommitted!
fi
if [ $(echo "$IP_ADDR" | grep -o "\." | wc -l) -eq 0 ];then # Only a number specified ?
IP_ADDR=${POOL_SUBNET}.$IP_ADDR
echo -e $KEYWORD $IP_ADDR $SUBNET_MASK >> $CCD_FILE
else
echo -e $KEYWORD $IP_ADDR $SUBNET_MASK >> $CCD_FILE # Use full I/P address as supplied
fi
;;
*ipv6* | *ip6*) # IPv6
if [ "$KEYWORD" == "staticip6" ];then # My psuedo OpenVPN server directive
KEYWORD="ifconfig-ipv6-push" # Use real OpenVPN IPv6 statement rather than our 'staticip6' codeword
# e.g. ifconfig-ipv6-push 2a03:b0c0:1:d0::7f:8003/64 recommended to use /64
logger -st "($(basename $0))" $$ "Psuedo command 'staticip6' converted to 'ifconfig-ipv6-push'!"
fi
echo -e $KEYWORD $IP_ADDR $SUBNET_MASK >> $CCD_FILE
;;
esac
;;
*passthru*) # My pseudo OpenVPN server directive
# This client will 'pass-thru' the router and use the VPN client specified
# e.g. pass-thru 2
Parse "$LINE" " " KEYWORD VPN_NUM
PASSTHRU=1
;;
*forcedns*) # My pseudo OpenVPN server directive
# This client cannot override the pushed DNS
# e.g. forcedns 10.0.0.254
Parse "$LINE" " " KEYWORD FORCED_DNS
FORCEDNS=1
;;
*lanonly*) # My pseudo OpenVPN server directive
# This client cannot 'pass-thru' outbound via the WAN or any VPN Client tunnel; only LAN resources are accessible
LANONLY=1
;;
*)
echo -e "$LINE" >> $CCD_FILE # Assume user has RTFM'd ADVANCED CCD directive & specified correct syntax!!!
# i.e. push,push-reset,iroute,iroute-ipv6,disable and config
;;
esac
# Was the 'pass-thru' directive found? and 'LAN only' wasn't specified
if [ "$PASSTHRU" == "1" ] && [ "$LANONLY" != "1" ];then
<snip>
fi
# Was the 'lanonly' directive found?
if [ "$LANONLY" == "1" ];then
logger -st "($(basename $0))" $$ "Psuedo command 'lanonly' will be applied to I/P" $IP_ADDR
iptables -D FORWARD -i tun2${VPN_SERVER_ID} -s $IP_ADDR -o $(nvram get wan0_ifname) -m state --state NEW -j DROP
iptables -I FORWARD -i tun2${VPN_SERVER_ID} -s $IP_ADDR -o $(nvram get wan0_ifname) -m state --state NEW -j DROP
fi
<snip>