Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We cant have a listener for all available addresses #935

Closed
gbregman opened this issue Nov 5, 2024 · 0 comments · Fixed by #936
Closed

We cant have a listener for all available addresses #935

gbregman opened this issue Nov 5, 2024 · 0 comments · Fixed by #936
Assignees

Comments

@gbregman
Copy link
Contributor

gbregman commented Nov 5, 2024

When we add a listener to the system we must use the specific address is listens on. SPDK wouldn't let us to use INADDR_ANY (that is, 0.0.0.0) as an address and allow connection for each and every interface. This can be solved by applying the following change to SPDK:

diff --git a/lib/nvme/nvme.c b/lib/nvme/nvme.c
index 5b08198b0..97b3997a0 100644
--- a/lib/nvme/nvme.c
+++ b/lib/nvme/nvme.c
@@ -1453,9 +1453,18 @@ spdk_nvme_transport_id_compare(const struct spdk_nvme_transport_id *trid1,
                return spdk_pci_addr_compare(&pci_addr1, &pci_addr2);
        }

-       cmp = strcasecmp(trid1->traddr, trid2->traddr);
-       if (cmp) {
-               return cmp;
+       if (trid1->trtype == SPDK_NVME_TRANSPORT_TCP &&
+               ((trid1->adrfam == SPDK_NVMF_ADRFAM_IPV4 && strcasecmp(trid1->traddr, "0.0.0.0") == 0) ||
+               (trid1->adrfam == SPDK_NVMF_ADRFAM_IPV6 && strcasecmp(trid1->traddr, "::") == 0))) {
+
+               /* If the listener uses INADDR_ANY allow all IP addresses */
+               cmp = 0;
+       }
+       else {
+               cmp = strcasecmp(trid1->traddr, trid2->traddr);
+               if (cmp) {
+                       return cmp;
+               }
        }

        cmp = cmp_int(trid1->adrfam, trid2->adrfam);
@github-project-automation github-project-automation bot moved this to 🆕 New in NVMe-oF Nov 5, 2024
@gbregman gbregman self-assigned this Nov 5, 2024
gbregman added a commit to gbregman/ceph-nvmeof that referenced this issue Nov 5, 2024
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in NVMe-oF Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant