Skip to content

Commit ce87e8c

Browse files
committed
fabrics: sanitize FC traddr
Improve traddr sanitization and replace “,” with “:” as the separator. (cherry picked from 14828a107) Signed-off-by: Daniel Wagner <[email protected]>
1 parent 2e67fa3 commit ce87e8c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/nvme/fabrics.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,17 @@ static void sanitize_discovery_log_entry(struct nvmf_disc_log_entry *e)
12841284
{
12851285
strchomp(e->trsvcid, sizeof(e->trsvcid));
12861286
strchomp(e->traddr, sizeof(e->traddr));
1287+
1288+
/*
1289+
* Report traddr always in 'nn-0x:pn-0x' format, but some discovery logs
1290+
* provide 'nn-0x,pn-0x'.
1291+
*/
1292+
if (e->trtype == NVMF_TRTYPE_FC) {
1293+
char *comma = strchr(e->traddr, ',');
1294+
1295+
if (comma)
1296+
*comma = ':';
1297+
}
12871298
}
12881299

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

0 commit comments

Comments
 (0)