Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Acedus
Copy link
Contributor

@Acedus Acedus commented Aug 27, 2025

Describe what this PR does

Previously ParseClientIP would use regex to match addresses which was too strict and could only correctly match complete ipv4 and ipv6 addresses.

This commit changes the ParseClientIP function to use Go's net package to correctly parse all valid ip forms.

Is there anything that requires special attention

Do you have any questions?
No

Is the change backward compatible?
Yes

Are there concerns around backward compatibility?
No

Provide any external context for the change, if any.

For example:

  • Kubernetes links that explain why the change is required
  • CSI spec related changes/catch-up that necessitates this patch
  • golang related practices that necessitates this change

Related issues

Mention any github issues relevant to this PR. Adding below line
will help to auto close the issue once the PR is merged.

Fixes: #issue_number

Future concerns

List items that are not part of the PR and do not impact it's
functionality, but are work items that can be taken up subsequently.

Checklist:

  • Commit Message Formatting: Commit titles and messages follow
    guidelines in the developer
    guide
    .
  • Reviewed the developer guide on Submitting a Pull
    Request
  • Pending release
    notes

    updated with breaking and/or notable changes for the next major release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

Show available bot commands

These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:

  • /retest ci/centos/<job-name>: retest the <job-name> after unrelated
    failure (please report the failure too!)

@Acedus
Copy link
Contributor Author

Acedus commented Aug 27, 2025

fyi @akalenyu

Copy link

@akalenyu akalenyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @nixpanic

seems like this is a bug in 3.15

{
name: "IPv6 address",
addr: "2001:0db8:85a3:0000:0000:8a2e:0370:7334:0/2686266785",
addr: "[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:0/2686266785",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the new impl. digest both? I wonder why the unit test was doing bracketless

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New impl can't digest bracketless, but this should be the correct and mandatory notation as defined by RFC 3986 for ipv6 addresses with a specified port, as is the case here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, should be okay, any backwards compatibility concern would be hopefully noted by maintainers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think 2001:0db8:85a3:0000:0000:8a2e:0370:7334:0 is a valid formatted IPv6 address, as the last :0 refers to a port (or wildcard in case of 0 with the Ceph session).

The format [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:0 looks more correct to me.

@Acedus
Copy link
Contributor Author

Acedus commented Aug 28, 2025

Change - Fix lint issues.

@iPraveenParihar
Copy link
Contributor

Hey @Acedus, thanks for the PR.
fix(util) is not an valid component in commit title (follow - guide)

You could just use util: <subject> format

@Rakshith-R
Copy link
Contributor

https://github.com/ceph/ceph-csi/actions/runs/17289568981/job/49168477608?pr=5547
@Acedus go-test is still failing

=== CONT  TestFetchIP/client.4305_2001:0db8:85a3:0000:0000:8a2e:0370:7334:0/422650892
    fencing_test.go:95: expected error false but got failed to extract IP address, incorrect format: address client.4305 2001:0db8:85a3:0000:0000:8a2e:0370:7334:0/422650892: too many colons in address
    fencing_test.go:99: expected IP 2001:db8:85a3::8a2e:370:7334 but got 
--- FAIL: TestFetchIP (0.00s)
    --- FAIL: TestFetchIP/client.4305_172.21.9.34:0/422650892 (0.00s)
    --- PASS: TestFetchIP/#00 (0.00s)
    --- FAIL: TestFetchIP/client.24152_v1:100.64.0.7:0/3658550259 (0.00s)
    --- FAIL: TestFetchIP/client.4305_2001:0db8:85a3:0000:0000:8a2e:0370:7334:0/422650892 (0.00s)
FAIL

@Rakshith-R Rakshith-R requested a review from nixpanic September 1, 2025 06:28
@nixpanic nixpanic added bug Something isn't working component/util Utility functions shared between CephFS and RBD backport-to-release-v3.15 Label to backport from devel to release-v3.15 branch labels Sep 1, 2025
@Acedus
Copy link
Contributor Author

Acedus commented Sep 1, 2025

Change - Address comments, take care to iterate on valid host pairs and omit version prefix before parse attempts.

@Acedus Acedus force-pushed the fix-ip-parsing branch 3 times, most recently from 9b632ab to 75fc490 Compare September 1, 2025 12:45
@nixpanic nixpanic requested a review from a team September 2, 2025 09:54
@Rakshith-R Rakshith-R added the ci/skip/e2e skip running e2e CI jobs label Sep 3, 2025
@Rakshith-R
Copy link
Contributor

@Mergifyio queue

@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2025

queue

🛑 The pull request has been removed from the queue default

Details

The pull request can't be updated.

You can take a look at Queue: Embarked in merge queue check runs for more details about the failure.

@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated.

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@Rakshith-R
Copy link
Contributor

@Mergifyio rebase

Previously ParseClientIP would use regex to match addresses which was
too strict and could only correctly match complete ipv4 and ipv6
addreses.

This commit changes the ParseClientIP function to use Go's net package
to correctly parse all valid ip forms.

Signed-off-by: Adi Aloni <[email protected]>
@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2025

rebase

✅ Branch has been successfully rebased

@iPraveenParihar
Copy link
Contributor

@Mergifyio queue

@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2025

queue

🛑 The pull request has been removed from the queue default

Details

The merge conditions cannot be satisfied due to failing checks.

You can take a look at Queue: Embarked in merge queue check runs for more details about the failure.

@Rakshith-R Rakshith-R removed the ci/skip/e2e skip running e2e CI jobs label Sep 3, 2025
@iPraveenParihar iPraveenParihar added the ok-to-test Label to trigger E2E tests label Sep 3, 2025
@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.33

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.31

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.33

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.31

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.33

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.31

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.32

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.32

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.32

@ceph-csi-bot ceph-csi-bot removed the ok-to-test Label to trigger E2E tests label Sep 3, 2025
@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2025

This pull request has been removed from the queue for the following reason: checks failed.

The merge conditions cannot be satisfied due to failing checks:

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@Rakshith-R
Copy link
Contributor

@Mergifyio requeue

@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2025

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

@mergify mergify bot merged commit 075782e into ceph:devel Sep 3, 2025
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-release-v3.15 Label to backport from devel to release-v3.15 branch bug Something isn't working component/util Utility functions shared between CephFS and RBD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants