aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_inet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ngx_inet.c')
-rw-r--r--src/core/ngx_inet.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index de4cae280..31094ba59 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -214,7 +214,13 @@ ngx_ptocidr(ngx_str_t *text, void *cidr)
in_cidr->mask = htonl((ngx_uint_t) (0 - (1 << (32 - m))));
- return NGX_OK;
+ if (in_cidr->addr == (in_cidr->addr & in_cidr->mask)) {
+ return NGX_OK;
+ }
+
+ in_cidr->addr &= in_cidr->mask;
+
+ return NGX_DONE;
}