diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index d966676541..6f60c199ca 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -403,7 +403,7 @@ static void ipRangeToStr(SIpV4Range *range, char *buf) { addr.s_addr = range->ip; uv_inet_ntop(AF_INET, &addr, buf, 32); - if (range->mask != 0) { + if (range->mask != 32) { sprintf(buf + strlen(buf), "/%d", range->mask); } return; diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 27fec4cf10..15b7f93ed0 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1676,7 +1676,7 @@ static int32_t getIpV4RangeFromWhitelistItem(char* ipRange, SIpV4Range* pIpRange struct in_addr addr; if (uv_inet_pton(AF_INET, ipCopy, &addr) == 0) { pIpRange->ip = addr.s_addr; - pIpRange->mask = 0; + pIpRange->mask = 32; code = TSDB_CODE_SUCCESS; } else { code = TSDB_CODE_PAR_INVALID_IP_RANGE; diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 8e7507b3fe..b7dd438fc8 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -690,7 +690,7 @@ uint32_t subnetIpRang2Int(SIpV4Range* pRange) { return (el[0] << 24) | (el[1] << 16) | (el[2] << 8) | (el[0]); } int32_t subnetInit(SubnetUtils* pUtils, SIpV4Range* pRange) { - if (pRange->mask == 0 || pRange->mask == 32) { + if (pRange->mask == 32) { pUtils->type = 0; pUtils->address = pRange->ip; return 0; @@ -704,7 +704,7 @@ int32_t subnetInit(SubnetUtils* pUtils, SIpV4Range* pRange) { pUtils->network = pUtils->address & pUtils->netmask; pUtils->broadcast = (pUtils->network) | (pUtils->netmask ^ 0xFFFFFFFF); - pUtils->type = (pRange->mask == 0 ? 0 : 1); + pUtils->type = (pRange->mask == 32 ? 0 : 1); return 0; } @@ -737,7 +737,7 @@ int32_t transUtilSIpRangeToStr(SIpV4Range* pRange, char* buf) { len = strlen(buf); - if (pRange->mask != 0 && pRange->mask != 32) { + if (pRange->mask != 32) { len += sprintf(buf + len, "/%d", pRange->mask); } buf[len] = 0;