From 2c43473adc6b3cf623b64e036df9a2a63e83f229 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Wed, 8 Jun 2016 14:12:55 +0800 Subject: [PATCH] nvmf: fix fabricintf parsing in spdk_nvmf_parse_port function The index should be 0 for fabricintf. Moreover, when there is no fabricintf found, error should be returned Change-Id: I3aa04566a5a318b8c921dd37c8573ed075254266 Signed-off-by: Ziye Yang --- lib/nvmf/conf.c | 7 ++++++- test/nvmf/nvmf.conf | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/nvmf/conf.c b/lib/nvmf/conf.c index 0b6b7eee0..31bf3bc8a 100644 --- a/lib/nvmf/conf.c +++ b/lib/nvmf/conf.c @@ -222,7 +222,7 @@ spdk_nvmf_parse_port(struct spdk_conf_section *sp) /* Loop over the fabric interfaces and add them to the port */ for (i = 0; ; i++) { - listen_addr = spdk_conf_section_get_nmval(sp, "FabricIntf", i, 1); + listen_addr = spdk_conf_section_get_nmval(sp, "FabricIntf", i, 0); if (listen_addr == NULL) { break; } @@ -238,6 +238,11 @@ spdk_nvmf_parse_port(struct spdk_conf_section *sp) spdk_nvmf_port_add_fabric_intf(port, fabric_intf); } + if (TAILQ_EMPTY(&port->head)) { + SPDK_ERRLOG("No fabric interface found\n"); + return -1; + } + return 0; } diff --git a/test/nvmf/nvmf.conf b/test/nvmf/nvmf.conf index b710defb1..459530374 100644 --- a/test/nvmf/nvmf.conf +++ b/test/nvmf/nvmf.conf @@ -12,7 +12,7 @@ [Port1] Comment "Test1" - FabricIntf DA1 192.168.100.8:7174 + FabricIntf 192.168.100.8:7174 [InitiatorGroup1] Comment "Initiator Group1"