diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2023-01-23 21:32:46 +0100 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2023-01-26 09:19:23 -0500 |
commit | d19e8e6ed0b8e28fdf231c8c40127d93386e7921 (patch) | |
tree | 5ac9d643b8e4517b7bca456b836783b997f0859d | |
parent | 8c9db57ed02c3cafba362b7f2dae301f26b2f419 (diff) | |
download | sos-d19e8e6ed0b8e28fdf231c8c40127d93386e7921.tar.gz |
[cleaner] Improve separating host from IPv6 address
Fix a corner case in separating host address from an IPv6 address when
the host string is (substring of) the network address string.
Resolves: #3121
Relevant: #3120
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/cleaner/mappings/ipv6_map.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sos/cleaner/mappings/ipv6_map.py b/sos/cleaner/mappings/ipv6_map.py index cfe2900e..d2871513 100644 --- a/sos/cleaner/mappings/ipv6_map.py +++ b/sos/cleaner/mappings/ipv6_map.py @@ -263,12 +263,9 @@ class ObfuscatedIPv6Network(): ]) if addr.compressed not in self.hosts: - try: - _, _host = addr.compressed.split(self.network_addr.rstrip(':')) - except ValueError: - # network addr is simply '::' - _n, _host = addr.compressed.split(self.network_addr) - _host = _host.lstrip(':') + # separate host from the address by removing its network prefix + _n = self.network_addr.rstrip(':') + _host = addr.compressed[len(_n):].lstrip(':') _ob_host = _generate_address() while _ob_host in self.hosts.values(): _ob_host = _generate_address() |