~mdw
/
firewall
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
e91f4bb
)
functions.m4: New function for arranging that an ipset exists.
author
Mark Wooding
<mdw@distorted.org.uk>
Sat, 23 Jul 2011 11:49:59 +0000
(12:49 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sat, 23 Jul 2011 11:54:57 +0000
(12:54 +0100)
functions.m4
patch
|
blob
|
blame
|
history
diff --git
a/functions.m4
b/functions.m4
index
fd24364
..
05decbf
100644
(file)
--- a/
functions.m4
+++ b/
functions.m4
@@
-89,6
+89,19
@@
clearchain () {
done
}
+## makeset SET TYPE [PARAMS]
+##
+## Ensure that the named ipset exists. Don't clear it.
+makeset () {
+ set -e
+ name=$1; shift
+ if ipset -nL | grep -q "^Name: $name$"; then
+ :
+ else
+ ipset -N "$name" "$@"
+ fi
+}
+
## errorchain CHAIN ACTION ARGS ...
##
## Make a chain which logs a message and then invokes some other action,