summaryrefslogtreecommitdiff
path: root/templates/firewall/group/address-group
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2011-05-03 17:28:08 +0800
committerAn-Cheng Huang <ancheng@vyatta.com>2011-05-03 17:28:08 +0800
commit22d37f427054b52bd724c17d9656bca6dee7d3c5 (patch)
tree656383e504a44572561e93a93898f31409886423 /templates/firewall/group/address-group
parent6ce1a694e899ee9b99fd3ab55a6a156b6d76b91b (diff)
downloadvyatta-cfg-firewall-22d37f427054b52bd724c17d9656bca6dee7d3c5.tar.gz
vyatta-cfg-firewall-22d37f427054b52bd724c17d9656bca6dee7d3c5.zip
modify firewall groups to work with new commitnapa-dev
Diffstat (limited to 'templates/firewall/group/address-group')
-rw-r--r--templates/firewall/group/address-group/node.def11
-rw-r--r--templates/firewall/group/address-group/node.tag/address/node.def93
2 files changed, 2 insertions, 102 deletions
diff --git a/templates/firewall/group/address-group/node.def b/templates/firewall/group/address-group/node.def
index 40462fa..5b2e510 100644
--- a/templates/firewall/group/address-group/node.def
+++ b/templates/firewall/group/address-group/node.def
@@ -15,12 +15,5 @@ syntax:expression: pattern $VAR(@) "^[^!]" ; \
syntax:expression: pattern $VAR(@) "^[^|;&$<>]*$" ; \
"Firewall group name cannot contain shell punctuation"
-create: sudo /opt/vyatta/sbin/vyatta-ipset.pl \
- --action=create-set \
- --set-type=address \
- --set-name="$VAR(@)"
-
-
-delete: sudo /opt/vyatta/sbin/vyatta-ipset.pl \
- --action=delete-set \
- --set-name="$VAR(@)"
+end: sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=update-set \
+ --set-name="$VAR(@)" --set-type=address
diff --git a/templates/firewall/group/address-group/node.tag/address/node.def b/templates/firewall/group/address-group/node.tag/address/node.def
index a04dd5b..2629b9d 100644
--- a/templates/firewall/group/address-group/node.tag/address/node.def
+++ b/templates/firewall/group/address-group/node.tag/address/node.def
@@ -10,96 +10,3 @@ syntax:expression: exec "sudo /opt/vyatta/sbin/vyatta-ipset.pl \
--set-type=address \
--member=\"$VAR(@)\"; "
-create: tmpgrp=$VAR(../@)-$PPID
- len=${#tmpgrp}
- if [ "$len" -gt 31 ]; then
- tmpgrp=${tmpgrp: -31};
- if [[ "$tmpgrp" =~ ^- ]]; then
- tmpgrp=${tmpgrp/-/Z};
- fi
- fi
- tmpfile="/tmp/$tmpgrp";
-
- # echo create $VAR(@) $tmpgrp $COMMIT_SIBLING_POSITION
-
- if [ "$COMMIT_SIBLING_POSITION" = "FIRST" ] || \
- [ "$COMMIT_SIBLING_POSITION" = "FIRSTLAST" ] ; then
- sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=is-set-empty \
- --set-name=$VAR(../@)
- if [ $? != 0 ]; then
- # echo create $tmpfile;
- touch $tmpfile;
- fi;
- sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=copy-set \
- --set-name=$VAR(../@) --set-type=address --set-copy=$tmpgrp
- # echo create $tmpgrp
- fi;
-
- sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=add-member \
- --set-name="$tmpgrp" --member="$VAR(@)" --alias=$VAR(../@)
- if [ $? != 0 ]; then
- # echo error adding, destroy $tmpgrp
- sudo ipset --destroy $tmpgrp;
- if [ -e $tmpfile ]; then
- # echo destroy $VAR(../@)
- sudo ipset --destroy $VAR(../@);
- rm $tmpfile;
- fi;
- exit 1;
- fi;
-
- if [ "$COMMIT_SIBLING_POSITION" = "LAST" ] || \
- [ "$COMMIT_SIBLING_POSITION" = "FIRSTLAST" ] ; then
- # echo swap and destroy $tmpgrp
- sudo ipset --swap $tmpgrp "$VAR(../@)";
- sudo ipset --destroy $tmpgrp;
- rm -f $tmpfile;
- fi;
-
-delete: tmpgrp=$VAR(../@)-$PPID
- len=${#tmpgrp}
- if [ "$len" -gt 31 ]; then
- tmpgrp=${tmpgrp: -31};
- if [[ "$tmpgrp" =~ ^- ]]; then
- tmpgrp=${tmpgrp/-/Z};
- fi
- fi
- tmpfile="/tmp/$tmpgrp";
-
- # echo delete $VAR(@) $tmpgrp $COMMIT_SIBLING_POSITION
-
- if [ "$COMMIT_SIBLING_POSITION" = "FIRST" ] || \
- [ "$COMMIT_SIBLING_POSITION" = "FIRSTLAST" ] ; then
- sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=is-set-empty \
- --set-name=$VAR(../@)
- if [ $? != 0 ]; then
- # echo create $tmpfile;
- touch $tmpfile;
- fi;
- sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=copy-set \
- --set-name=$VAR(../@) --set-type=address --set-copy=$tmpgrp
- # echo create $tmpgrp
- fi;
-
- sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=is-group-deleted \
- --set-name=$VAR(../@) --set-type=address;
- if [ $? == 0 ] ; then
- sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=is-group-used \
- --set-name=$VAR(../@) --set-type=address
- if [ $? == 0 ] ; then
- echo "Error: group [$VAR(../@)] still in use."
- exit 1;
- fi
- fi
-
- sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=delete-member \
- --set-name=$tmpgrp \
- --member="$VAR(@)"
-
- if [ "$COMMIT_SIBLING_POSITION" = "LAST" ] || \
- [ "$COMMIT_SIBLING_POSITION" = "FIRSTLAST" ] ; then
- # echo swap and destroy $tmpgrp
- sudo ipset --swap $tmpgrp "$VAR(../@)";
- sudo ipset --destroy $tmpgrp;
- rm -f $tmpfile;
- fi;