Skip to content

Commit 01f8db9

Browse files
committed
fabrics: sanitize FC traddr
Improve the sanitize traddr a bit more and replace a "," with ":" as separator. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 226f3be commit 01f8db9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,17 @@ static void sanitize_discovery_log_entry(struct nvmf_disc_log_entry *e)
13471347
{
13481348
strchomp(e->trsvcid, sizeof(e->trsvcid));
13491349
strchomp(e->traddr, sizeof(e->traddr));
1350+
1351+
/*
1352+
* Report traddr always in 'nn-0x:pn-0x' format, but some discovery logs
1353+
* provide 'nn-0x,pn-0x'.
1354+
*/
1355+
if (e->trtype == NVMF_TRTYPE_FC) {
1356+
char *comma = strchr(e->traddr, ',');
1357+
1358+
if (comma)
1359+
*comma = ':';
1360+
}
13501361
}
13511362

13521363
int nvmf_get_discovery_log(nvme_ctrl_t c, struct nvmf_discovery_log **logp,

0 commit comments

Comments
 (0)