changeset 6662:1301a58b5dac

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).
author Ruslan Ermilov <ru@nginx.com>
date Tue, 23 Aug 2016 15:59:06 +0300
parents ec141a44641b
children 53198d9bf84f
files src/http/modules/ngx_http_geo_module.c src/stream/ngx_stream_geo_module.c
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
 
     warn = 0;
 
-    for (n = start; n <= end; n += 0x10000) {
+    for (n = start; n <= end; n = (n + 0x10000) & 0xffff0000) {
 
         h = n >> 16;
 
--- 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 *
 
     warn = 0;
 
-    for (n = start; n <= end; n += 0x10000) {
+    for (n = start; n <= end; n = (n + 0x10000) & 0xffff0000) {
 
         h = n >> 16;