]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Get connections after tickle list
authorMartin Schwenke <mschwenke@ddn.com>
Mon, 30 Sep 2024 00:50:00 +0000 (10:50 +1000)
committerJule Anger <janger@samba.org>
Mon, 25 Nov 2024 12:39:11 +0000 (12:39 +0000)
Running ss to get current connections before running ctdb gettickles
means the ss output might be out of date when the 2 lists are
compared.  Some tickles might have been added after ss was run by some
other means (e.g. SMB tickles, added internally) and they would be
deleted according to the stale ss output.

This isn't currently a problem because update_tickles() is currently
only called with port 2049, so all tickles are managed by this code.
That will change in a subsequent commit.

Changing the order means the reverse problem can occur, where
update_tickles() attempts to delete an already deleted tickle.  That
may happen occasionally but is harmless because it doesn't result in
missing information.  It (currently) just causes a message to be
logged at DEBUG level.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15320
RN: Update CTDB to track all TCP connections to public IP addresses

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jerry Heyman <jheyman@ddn.com>
(cherry picked from commit c3695722b6316b624aa6c44cad4f44279303d1b1)

ctdb/config/functions

index 521f0cdfacc5744a8b5902b440e84b9e5d676f02..7d371e815050311a3829c3494ee323efdabd63ef 100755 (executable)
@@ -1166,6 +1166,14 @@ update_tickles()
        done <"$CTDB_MY_PUBLIC_IPS_CACHE"
        _port_filter="sport == :${_port}"
 
+       # Record our current tickles in a temporary file
+       _my_tickles="${tickledir}/${_port}.tickles.$$"
+       while read -r _i; do
+               $CTDB -X gettickles "$_i" "$_port" |
+                       awk -F'|' 'NR > 1 { printf "%s:%s %s:%s\n", $2, $3, $4, $5 }'
+       done <"$CTDB_MY_PUBLIC_IPS_CACHE" |
+               sort >"$_my_tickles"
+
        # Record connections to our public IPs in a temporary file.
        # This temporary file is in CTDB's private state directory and
        # $$ is used to avoid a very rare race involving CTDB's script
@@ -1179,14 +1187,6 @@ update_tickles()
                awk '{print $4, $3}' |
                sort >"$_my_connections"
 
-       # Record our current tickles in a temporary file
-       _my_tickles="${tickledir}/${_port}.tickles.$$"
-       while read -r _i; do
-               $CTDB -X gettickles "$_i" "$_port" |
-                       awk -F'|' 'NR > 1 { printf "%s:%s %s:%s\n", $2, $3, $4, $5 }'
-       done <"$CTDB_MY_PUBLIC_IPS_CACHE" |
-               sort >"$_my_tickles"
-
        # Add tickles for connections that we haven't already got tickles for
        comm -23 "$_my_connections" "$_my_tickles" |
                $CTDB addtickle