aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2016-08-23 15:59:06 +0300
committerRuslan Ermilov <ru@nginx.com>2016-08-23 15:59:06 +0300
commitf927ab882a343799b0a9dec2e3240d34d60cca1c (patch)
tree9a80b7c1fd718ded5daf7246232840584f0142b5
parent36e1c887db80b0e3510e15ddeef93979ecd61ff7 (diff)
downloadnginx-f927ab882a343799b0a9dec2e3240d34d60cca1c.tar.gz
nginx-f927ab882a343799b0a9dec2e3240d34d60cca1c.zip
Geo: fixed removing a range in certain cases.
If the range includes two or more /16 networks and does not start at the /16 boundary, the last subrange was not removed (see 91cff7f97a50 for details).
-rw-r--r--src/http/modules/ngx_http_geo_module.c2
-rw-r--r--src/stream/ngx_stream_geo_module.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c
index af061af81..e64380401 100644
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -966,7 +966,7 @@ ngx_http_geo_delete_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
warn = 0;
- for (n = start; n <= end; n += 0x10000) {
+ for (n = start; n <= end; n = (n + 0x10000) & 0xffff0000) {
h = n >> 16;
diff --git a/src/stream/ngx_stream_geo_module.c b/src/stream/ngx_stream_geo_module.c
index 3bdeff723..1ee0154d3 100644
--- a/src/stream/ngx_stream_geo_module.c
+++ b/src/stream/ngx_stream_geo_module.c
@@ -916,7 +916,7 @@ ngx_stream_geo_delete_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx,
warn = 0;
- for (n = start; n <= end; n += 0x10000) {
+ for (n = start; n <= end; n = (n + 0x10000) & 0xffff0000) {
h = n >> 16;