Martineau
Part of the Furniture
Here is how I use vpnrouting.sh to process the modified NVRAM/GUI to make it convenient to add the VPN fwmark taggingFor preliminary testing, I put code in for DST for testing and commented out the rest in vpnrouting.sh.
The lists are deleted properly from the master IPSET list for the VPN Client interface when deleted in the web gui or the client is turned off. Everything went with out a hitch.Code:######################## Xentrk updates for Martineau's awesome Web GUI IPSET features # Proccess IPSET lists # 'DST/SRC/DDD/SSS' 3-dimensional IPSET list # 'SD/DS/DD/' 2-dimensional IPSET # if [ "$TARGET_ROUTE" = "DST" ]; then ipset add OVPNC${VPN_UNIT} "$DESC" continue # elif [ "$TARGET_ROUTE" = "SRC" ]; then # ipset add OVPNC${VPN_UNIT} "$DESC" # continue <snip> ######################################
Code:
if [ ! -z "$(echo $TARGET_ROUTE | grep -oE "SRC|DST|^D|^S")" ];then
IPSET_NAME=$DESC
# Allow for 2-dimension and 3-dimension IPSETs.....
case $TARGET_ROUTE in # TBA review static 'case' with a regexp? ;-)
SRC|DST) DIM=(echo $TARGET_ROUTE | tr 'A-Z' 'a-z');;
*) case $TARGET_ROUTE in
DD) DIM="dst,dst";;
SS) DIM="src,src";;
DS) DIM="dst,src";;
SD) DIM="src,dst";;
DDS) DIM="dst,dst,src";;
SSS) DIM="src,src,src";;
SSD) DIM="src,src,dst";;
DDD) DIM="dst,dst,dst";;
esac
esac
# If the Source IP is a real LAN IP then include it in the IPSET fwmark rule
<snip>
# Validate that $IPSET_NAME does physically exist etc.
<snip>
# before tagging with appropriate VPN Client fwmark
iptables -t mangle -D PREROUTING $SRC -i br0 -m set --match-set $IPSET_NAME $DIM -j MARK --set-mark $TAG_MARK/$TAG_MARK 2> /dev/null
iptables -t mangle -A PREROUTING $SRC -i br0 -m set --match-set $IPSET_NAME $DIM -j MARK --set-mark $TAG_MARK/$TAG_MARK 2> /dev/null
fi
So, perhaps you should alter the logic to assume if all three dimensions are blank, then the IPSET name should then be added to an existing master IPSET list?, or perhaps an additional GUI 'add' check box?