Skip to content

Commit 05b3f6b

Browse files
committed
fabrics: issue a warning on invalid traddr format
Report that the traddr is invalid instead silently fix it only. Signed-off-by: Daniel Wagner <[email protected]>
1 parent d0c4d3a commit 05b3f6b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,8 @@ static int nvme_discovery_log(const struct libnvme_get_discovery_args *args,
13971397
return err;
13981398
}
13991399

1400-
static void sanitize_discovery_log_entry(struct nvmf_disc_log_entry *e)
1400+
static void sanitize_discovery_log_entry(struct libnvme_global_ctx *ctx,
1401+
struct nvmf_disc_log_entry *e)
14011402
{
14021403
strchomp(e->trsvcid, sizeof(e->trsvcid));
14031404
strchomp(e->traddr, sizeof(e->traddr));
@@ -1409,8 +1410,11 @@ static void sanitize_discovery_log_entry(struct nvmf_disc_log_entry *e)
14091410
if (e->trtype == NVMF_TRTYPE_FC) {
14101411
char *comma = strchr(e->traddr, ',');
14111412

1412-
if (comma)
1413+
if (comma) {
1414+
libnvme_msg(ctx, LOG_WARNING,
1415+
"invalid traddr separator ',' instead ':', fixing it");
14131416
*comma = ':';
1417+
}
14141418
}
14151419
}
14161420

@@ -1439,7 +1443,7 @@ __public int nvmf_get_discovery_wargs(struct libnvme_get_discovery_args *args,
14391443
return err;
14401444

14411445
for (int i = 0; i < le64_to_cpu(log->numrec); i++)
1442-
sanitize_discovery_log_entry(&log->entries[i]);
1446+
sanitize_discovery_log_entry(args->c->ctx, &log->entries[i]);
14431447

14441448
*logp = log;
14451449
return 0;

0 commit comments

Comments
 (0)