iscsi: ANY does not work as wild card netmask of ACL (degradation)
A few previous changes replaced ALL by ANY for the initiator group because ANY was normal for this case. ANY was tested enough for the initiator name of the initiator group but not tested for the netmask of the initiator group. Hence the previous changes caused degradation. This is the bug fix and UT code is added together. Change-Id: Idf7642dd4c111a4788aca31a0105b3497631aecd Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/392923 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
7e8a611568
commit
f53462b432
@ -168,7 +168,7 @@ spdk_iscsi_netmask_allow_addr(const char *netmask, const char *addr)
|
||||
if (netmask == NULL || addr == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (strcasecmp(netmask, "ALL") == 0) {
|
||||
if (strcasecmp(netmask, "ANY") == 0) {
|
||||
return true;
|
||||
}
|
||||
if (netmask[0] == '[') {
|
||||
|
@ -124,6 +124,24 @@ config_file_fail_cases(void)
|
||||
spdk_conf_free(config);
|
||||
}
|
||||
|
||||
static void
|
||||
allow_any_allowed(void)
|
||||
{
|
||||
bool result;
|
||||
char *netmask;
|
||||
char *addr1, *addr2;
|
||||
|
||||
netmask = "ANY";
|
||||
addr1 = "2001:ad6:1234:5678:9abc::";
|
||||
addr2 = "192.168.2.1";
|
||||
|
||||
result = spdk_iscsi_netmask_allow_addr(netmask, addr1);
|
||||
CU_ASSERT(result == true);
|
||||
|
||||
result = spdk_iscsi_netmask_allow_addr(netmask, addr2);
|
||||
CU_ASSERT(result == true);
|
||||
}
|
||||
|
||||
static void
|
||||
allow_ipv6_allowed(void)
|
||||
{
|
||||
@ -662,6 +680,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (
|
||||
CU_add_test(suite, "config file fail cases", config_file_fail_cases) == NULL
|
||||
|| CU_add_test(suite, "allow any allowed case", allow_any_allowed) == NULL
|
||||
|| CU_add_test(suite, "allow ipv6 allowed case", allow_ipv6_allowed) == NULL
|
||||
|| CU_add_test(suite, "allow ipv6 denied case", allow_ipv6_denied) == NULL
|
||||
|| CU_add_test(suite, "allow ipv4 allowed case", allow_ipv4_allowed) == NULL
|
||||
|
Loading…
Reference in New Issue
Block a user