ctdb-scripts: Add interface argument to kill_tcp_connections()
authorMartin Schwenke <martin@meltin.net>
Fri, 11 Mar 2016 04:27:10 +0000 (15:27 +1100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 1 Apr 2016 02:42:11 +0000 (04:42 +0200)
This will be needed for a rewrite of the connection killing code but
it is not used yet.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/events.d/10.interface
ctdb/config/events.d/91.lvs
ctdb/config/functions

index 4fb352454b0156d99b6b24196ea1fe1b1e5b05c4..f65dd5ea739851f482e076c44e8f9667aa808a6b 100755 (executable)
@@ -161,7 +161,7 @@ case "$1" in
        # we do an extra delete to cope with the script being killed
        iptables_wrapper $family -D INPUT -i $iface -d $ip -j DROP 2> /dev/null
        iptables_wrapper $family -I INPUT -i $iface -d $ip -j DROP
-       kill_tcp_connections $ip
+       kill_tcp_connections "$iface" "$ip"
 
        delete_ip_from_iface $iface $ip $maskbits || {
            iptables_wrapper $family \
index 47adf33c6d0c34288dd29283c0562b301a8151d8..57ee2c1a8cb2942fda3509abb117c4444201505a 100755 (executable)
@@ -44,7 +44,8 @@ case "$1" in
        # kill off any tcp connections
        ipvsadm -D -t $CTDB_LVS_PUBLIC_IP:0
        ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0
-       kill_tcp_connections_local_only $CTDB_LVS_PUBLIC_IP
+       kill_tcp_connections_local_only \
+               "$CTDB_PUBLIC_INTERFACE" "$CTDB_LVS_PUBLIC_IP"
 
        ctdb_get_pnn
        LVSMASTER=`ctdb lvsmaster | sed -e "s/.*Node //" -e "s/ .*//"`
index 9746895495a6460dba2a8b6013e07dc10506948e..aab7a143529c18d2a85a664daab7af3d4a38a148 100755 (executable)
@@ -430,10 +430,11 @@ ctdb_check_command ()
 ################################################
 kill_tcp_connections ()
 {
-    _ip="$1"
+    _iface="$1"
+    _ip="$2"
 
     _oneway=false
-    if [ "$2" = "oneway" ] ; then
+    if [ "$3" = "oneway" ] ; then
        _oneway=true
     fi
 
@@ -494,7 +495,7 @@ kill_tcp_connections ()
 ##################################################################
 kill_tcp_connections_local_only ()
 {
-    kill_tcp_connections "$1" "oneway"
+    kill_tcp_connections "$@" "oneway"
 }
 
 ##################################################################