[nginx] Geo: fixed removing a range in certain cases.

Ruslan Ermilov ru at nginx.com
Tue Aug 23 14:00:26 UTC 2016


details:   http://hg.nginx.org/nginx/rev/1301a58b5dac
branches:  
changeset: 6662:1301a58b5dac
user:      Ruslan Ermilov <ru at nginx.com>
date:      Tue Aug 23 15:59:06 2016 +0300
description:
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).

diffstat:

 src/http/modules/ngx_http_geo_module.c |  2 +-
 src/stream/ngx_stream_geo_module.c     |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r ec141a44641b -r 1301a58b5dac src/http/modules/ngx_http_geo_module.c
--- a/src/http/modules/ngx_http_geo_module.c	Tue Aug 23 15:57:29 2016 +0300
+++ b/src/http/modules/ngx_http_geo_module.c	Tue Aug 23 15:59:06 2016 +0300
@@ -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;
 
diff -r ec141a44641b -r 1301a58b5dac src/stream/ngx_stream_geo_module.c
--- a/src/stream/ngx_stream_geo_module.c	Tue Aug 23 15:57:29 2016 +0300
+++ b/src/stream/ngx_stream_geo_module.c	Tue Aug 23 15:59:06 2016 +0300
@@ -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;
 



More information about the nginx-devel mailing list