diff options
author | Martin Schwenke <martin@meltin.net> | 2012-07-17 15:37:14 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2012-07-26 21:14:58 +1000 |
commit | e7325ebcd562f10024e9ce777b37daa3836ffe8c (patch) | |
tree | b2f0eb02b094add972712b2ca64da6ea8f635f03 | |
parent | 9a7a1991321a16129c681b1b6ffc91ac2fbcdb8b (diff) | |
download | samba-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-x | ctdb/config/events.d/11.natgw | 6 |
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 |