From c4912e89cc87055dd95c8a83b4539d20e72e62d8 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Thu, 12 Mar 2026 16:01:48 +0100 Subject: [PATCH] fabrics: sanitize FC traddr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve traddr sanitization and replace “,” with “:” as the separator. Signed-off-by: Daniel Wagner --- libnvme/src/nvme/fabrics.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libnvme/src/nvme/fabrics.c b/libnvme/src/nvme/fabrics.c index 5f331cd159..1dee22245e 100644 --- a/libnvme/src/nvme/fabrics.c +++ b/libnvme/src/nvme/fabrics.c @@ -1347,6 +1347,17 @@ static void sanitize_discovery_log_entry(struct nvmf_disc_log_entry *e) { strchomp(e->trsvcid, sizeof(e->trsvcid)); strchomp(e->traddr, sizeof(e->traddr)); + + /* + * Report traddr always in 'nn-0x:pn-0x' format, but some discovery logs + * provide 'nn-0x,pn-0x'. + */ + if (e->trtype == NVMF_TRTYPE_FC) { + char *comma = strchr(e->traddr, ','); + + if (comma) + *comma = ':'; + } } int nvmf_get_discovery_log(nvme_ctrl_t c, struct nvmf_discovery_log **logp,