Skip to content

Commit 948dd1b

Browse files
authored
Merge pull request ceph#46163 from rkachach/fix_issue_55556
mgr/cephadm: fixing ipv6 handling during bootstrap Reviewed-by: Adam King <[email protected]> Reviewed-by: John Mulligan <[email protected]> Reviewed-by: Michael Fritch <[email protected]>
2 parents 3daac6f + ae0cbac commit 948dd1b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/cephadm/cephadm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4653,7 +4653,8 @@ def ip_in_subnets(ip_addr: str, subnets: str) -> bool:
46534653
"""Determine if the ip_addr belongs to any of the subnets list."""
46544654
subnet_list = [x.strip() for x in subnets.split(',')]
46554655
for subnet in subnet_list:
4656-
if ipaddress.ip_address(ip_addr) in ipaddress.ip_network(subnet):
4656+
ip_address = unwrap_ipv6(ip_addr) if is_ipv6(ip_addr) else ip_addr
4657+
if ipaddress.ip_address(ip_address) in ipaddress.ip_network(subnet):
46574658
return True
46584659
return False
46594660

src/cephadm/tests/test_cephadm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,6 +2309,10 @@ def test_ip_in_subnet(self):
23092309
rc = cd.ip_in_subnets('fe80::5054:ff:fef4:873a', 'fe80::/64')
23102310
assert rc is True
23112311

2312+
# valid wrapped ip and valid IPV6 network
2313+
rc = cd.ip_in_subnets('[fe80::5054:ff:fef4:873a]', 'fe80::/64')
2314+
assert rc is True
2315+
23122316
# valid ip and that doesn't belong to IPV6 network
23132317
rc = cd.ip_in_subnets('fe80::5054:ff:fef4:873a', '2001:db8:85a3::/64')
23142318
assert rc is False

0 commit comments

Comments
 (0)