summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-07-17 15:37:14 +1000
committerAmitay Isaacs <amitay@gmail.com>2012-07-26 21:14:58 +1000
commite7325ebcd562f10024e9ce777b37daa3836ffe8c (patch)
treeb2f0eb02b094add972712b2ca64da6ea8f635f03
parent9a7a1991321a16129c681b1b6ffc91ac2fbcdb8b (diff)
downloadsamba-e7325ebcd562f10024e9ce777b37daa3836ffe8c.tar.gz
samba-e7325ebcd562f10024e9ce777b37daa3836ffe8c.tar.xz
samba-e7325ebcd562f10024e9ce777b37daa3836ffe8c.zip
Eventscripts: Optimise building the host address in 11.natgw
It can be build without forking unnecessary processes. Also downcase variable name because it is local to script. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 34f58a0773618c4508a55ad75fc4602dad5a5f4c)
-rwxr-xr-xctdb/config/events.d/11.natgw6
1 files changed, 3 insertions, 3 deletions
diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw
index d06ca16227..8537a8cc0a 100755
--- a/ctdb/config/events.d/11.natgw
+++ b/ctdb/config/events.d/11.natgw
@@ -62,9 +62,9 @@ case "$1" in
iptables -A POSTROUTING -t nat -s $CTDB_NATGW_PRIVATE_NETWORK ! -d $CTDB_NATGW_PRIVATE_NETWORK -j MASQUERADE
# block all incoming connections to the natgw address
- CTDB_NATGW_PUBLIC_IP_HOST=`echo $CTDB_NATGW_PUBLIC_IP | sed -e "s/\/.*/\/32/"`
- iptables -D INPUT -p tcp --syn -d $CTDB_NATGW_PUBLIC_IP_HOST -j REJECT 2>/dev/null
- iptables -I INPUT -p tcp --syn -d $CTDB_NATGW_PUBLIC_IP_HOST -j REJECT 2>/dev/null
+ ctdb_natgw_public_ip_host="${CTDB_NATGW_PUBLIC_IP%/*}/32"
+ iptables -D INPUT -p tcp --syn -d $ctdb_natgw_public_ip_host -j REJECT 2>/dev/null
+ iptables -I INPUT -p tcp --syn -d $ctdb_natgw_public_ip_host -j REJECT 2>/dev/null
ip addr add $CTDB_NATGW_PUBLIC_IP dev $CTDB_NATGW_PUBLIC_IFACE
ip route add 0.0.0.0/0 via $CTDB_NATGW_DEFAULT_GATEWAY >/dev/null 2>/dev/null