Skip to content

cephadm: fix EndPoint to handle bracketed IPv6 addresses - #67530

Merged
rkachach merged 2 commits into
ceph:mainfrom
rkachach:fix_ipv6_with_brackets
Mar 16, 2026
Merged

rkachach merged 2 commits into
ceph:mainfrom
rkachach:fix_ipv6_with_brackets

Conversation

@rkachach

@rkachach rkachach commented Feb 25, 2026 •

Copy link
Copy Markdown
Contributor

Issue:

EndPoint ctr fails to correctly handle IPv6 addresses passed with surrounding brackets. In this case, ipaddress.ip_network() raises a ValueError, which is silently swallowed by the except block, leaving is_ipv4 = True. This causes __str__/__repr__ method to return a malformed address like fd19:8:5::11:3300 instead of [fd19:8:5::11]:3300.

Fix:

Normalize the self.ip field by stripping brackets on construction so we always save and use the bare ip. repr/str methods take care of appending the [] when needed.

Fixes: https://tracker.ceph.com/issues/75165

Manual testing:

[root@ceph-node-0 ~]# cephadm --image quay.ceph.io/ceph-ci/ceph:main bootstrap --mon-ip 2001:db8:100::10 --initial-dashboard-password admin --allow-fqdn-hostname --dashboard-password-noupdate --no-cleanup-on-failure
Verifying podman|docker is present...
Verifying lvm2 is present...
Verifying time synchronization is in place...
Unit chronyd.service is enabled and running
Repeating the final host check...
podman (/usr/bin/podman) version 4.9.4 is present
systemctl is present
lvcreate is present
Unit chronyd.service is enabled and running
Host looks OK
Cluster fsid: 3a3a5276-131c-11f1-a1ab-52540047d222
Verifying IP 2001:db8:100::10 port 3300 ...
Verifying IP 2001:db8:100::10 port 6789 ...
Mon IP `2001:db8:100::10` is in CIDR network `2001:db8:100::/64`
Mon IP `2001:db8:100::10` is in CIDR network `2001:db8:100::/64`
Internal network (--cluster-network) has not been provided, OSD replication will default to the public_network
Pulling container image quay.ceph.io/ceph-ci/ceph:main...
Ceph version: ceph version 20.3.0-5603-g237566a0 (237566a068813544160c5a938c95ff00f7ace50c) tentacle (dev)
Extracting ceph user uid/gid from container image...
Creating initial keys...
Creating initial monmap...
Creating mon...
Waiting for mon to start...
Waiting for mon...
mon is available
Assimilating anything we can from ceph.conf...
Generating new minimal ceph.conf...
Restarting the monitor...
Setting public_network to 2001:db8:100::/64 in global config section
Enabling IPv6 (ms_bind_ipv6) binding
Disabling IPv4 (ms_bind_ipv4) binding
Wrote config to /etc/ceph/ceph.conf
Wrote keyring to /etc/ceph/ceph.client.admin.keyring
Creating mgr...
Verifying port 0.0.0.0:9283 ...
Cannot bind to IP 0.0.0.0 port 9283: [Errno 98] Address already in use
Verifying port 0.0.0.0:8765 ...
Verifying port 0.0.0.0:8443 ...
Cannot bind to IP 0.0.0.0 port 8443: [Errno 98] Address already in use
ceph-mgr TCP port(s) 0.0.0.0:9283,0.0.0.0:8765,0.0.0.0:8443 already in use
Waiting for mgr to start...
Waiting for mgr...
mgr not available, waiting (1/15)...
mgr not available, waiting (2/15)...
mgr not available, waiting (3/15)...
mgr not available, waiting (4/15)...
mgr not available, waiting (5/15)...
mgr not available, waiting (6/15)...
mgr not available, waiting (7/15)...
mgr not available, waiting (8/15)...
mgr not available, waiting (9/15)...
mgr not available, waiting (10/15)...
mgr is available
Enabling cephadm module...
Waiting for the mgr to restart...
Waiting for mgr epoch 5...
mgr epoch 5 is available
Verifying orchestrator module is enabled...
Setting orchestrator backend to cephadm...
Generating ssh key...
Wrote public SSH key to /etc/ceph/ceph.pub
Adding key to root@localhost authorized_keys...
Adding host ceph-node-0...
Deploying mon service with default placement...
Deploying mgr service with default placement...
Deploying crash service with default placement...
Deploying ceph-exporter service with default placement...
Deploying prometheus service with default placement...
Deploying grafana service with default placement...
Deploying node-exporter service with default placement...
Deploying alertmanager service with default placement...
Enabling the dashboard module...
Waiting for the mgr to restart...
Waiting for mgr epoch 11...
mgr epoch 11 is available
Using certmgr to generate dashboard self-signed certificate...
Creating initial admin user...
Fetching dashboard port number...
Ceph Dashboard is now available at:

	     URL: https://ceph-node-0:8443/
	    User: admin
	Password: admin

Enabling client.admin keyring and conf on hosts with "admin" label
Saving cluster configuration to /var/lib/ceph/3a3a5276-131c-11f1-a1ab-52540047d222/config directory
You can access the Ceph CLI as following in case of multi-cluster or non-default config:

	sudo /root/bin/cephadm shell --fsid 3a3a5276-131c-11f1-a1ab-52540047d222 -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring

Or, if you are only running a single cluster on this host:

	sudo /root/bin/cephadm shell 

Please consider enabling telemetry to help improve Ceph:

	ceph telemetry on

For more information see:

	https://docs.ceph.com/en/latest/mgr/telemetry/

[root@ceph-node-0 ~]# netstat -anp  | grep ceph-mon
tcp6       0      0 2001:db8:100::10:6789   :::*                    LISTEN      77944/ceph-mon      
tcp6       0      0 2001:db8:100::10:3300   :::*                    LISTEN      77944/ceph-mon      
unix  2      [ ACC ]     STREAM     LISTENING     260348   77944/ceph-mon       /var/run/ceph/ceph-mon.ceph-node-0.asok
unix  2      [ ]         DGRAM                    260338   77944/ceph-mon       
unix  2      [ ]         DGRAM                    260408   77944/ceph-mon     

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

EndPoint ctr fails to correctly handle IPv6 addresses passed with
surrounding brackets. In this case, ipaddress.ip_network() raises
a ValueError, which is silently swallowed by the except block, leaving
is_ipv4 = True. This causes __str__/__repr__ method to return a malformed
address like fd19:8:5::11:3300 instead of [fd19:8:5::11]:3300.

Normalize the self.ip field by stripping brackets on construction so
we always save and use the bare ip. repr/str methods take care of
appending the [] when needed.

Fixes: https://tracker.ceph.com/issues/75165

Signed-off-by: Redouane Kachach <[email protected]>
@rkachach
rkachach requested a review from a team February 25, 2026 14:21
@rkachach
rkachach marked this pull request as ready for review February 26, 2026 09:36
@rkachach

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@rkachach

Copy link
Copy Markdown
Contributor Author

jenkins test api

@rkachach

Copy link
Copy Markdown
Contributor Author

@rkachach

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

1 similar comment
@rkachach

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@rkachach

Copy link
Copy Markdown
Contributor Author

@rkachach
rkachach merged commit 589476e into ceph:main Mar 16, 2026
9 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/23147908138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants