diff options
author | Martin Schwenke <martin@meltin.net> | 2019-12-13 11:09:04 +1100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2020-01-14 08:30:25 +0000 |
commit | 57390cc5a367376917f2c9a4545098742f7baccc (patch) | |
tree | 74bb78e5d2850488f094339b4e6d748e8292cf7a /ctdb | |
parent | 6a109e3ddb355ec91e136f8b8dfbd29631ce25e8 (diff) | |
download | samba-57390cc5a367376917f2c9a4545098742f7baccc.tar.gz |
ctdb-scripts: Strip square brackets when gathering connection info
ss added square brackets around IPv6 addresses in versions > 4.12.0
via commit aba9c23a6e1cb134840c998df14888dca469a485. CentOS 7 added
this feature somewhere mid-release. So, backward compatibility is
obviously needed.
As per the comment protocol/protocol_util.c should probably print and
parse such square brackets. However, for backward compatibility the
brackets would have to be stripped in both places in
update_tickles()... or added to the ss output when missing. Best to
leave this until we have a connection tracking daemon.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14227
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 693080abe4d8bec96280af5a6aa668251a98ec5d)
Diffstat (limited to 'ctdb')
-rwxr-xr-x | ctdb/config/functions | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions index 1dc16532890..2e9c3ef6bf0 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -977,10 +977,16 @@ update_tickles () _my_connections="${tickledir}/${_port}.connections.$$" # Parentheses are needed around the filters for precedence but # the parentheses can't be empty! + # + # Recent versions of ss print square brackets around IPv6 + # addresses. While it is desirable to update CTDB's address + # parsing and printing code, something needs to be done here + # for backward compatibility, so just delete the brackets. ss -tn state established \ "${_ip_filter:+( ${_ip_filter} )}" \ "${_port_filter:+( ${_port_filter} )}" | awk 'NR > 1 {print $4, $3}' | + tr -d '][' | sort >"$_my_connections" # Record our current tickles in a temporary file |