diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-08-10 13:13:28 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2007-08-10 13:13:28 +0000 |
commit | 845f6d553a48a74f12e9b80b7824d59da257bc82 (patch) | |
tree | 9b7866822b51333f875fd4bf147ebdd811b9d009 /src/http/modules/ngx_http_geo_module.c | |
parent | 7a8e33993a1322c11c583d96c5c47498fda12859 (diff) | |
download | nginx-845f6d553a48a74f12e9b80b7824d59da257bc82.tar.gz nginx-845f6d553a48a74f12e9b80b7824d59da257bc82.zip |
ignore meaningless bits in CIDR and warn about them
Diffstat (limited to 'src/http/modules/ngx_http_geo_module.c')
-rw-r--r-- | src/http/modules/ngx_http_geo_module.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c index 9c43bd716..bb9085e10 100644 --- a/src/http/modules/ngx_http_geo_module.c +++ b/src/http/modules/ngx_http_geo_module.c @@ -212,12 +212,20 @@ ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) cidrin.mask = 0; } else { - if (ngx_ptocidr(&value[0], &cidrin) == NGX_ERROR) { + rc = ngx_ptocidr(&value[0], &cidrin); + + if (rc == NGX_ERROR) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid parameter \"%V\"", &value[0]); return NGX_CONF_ERROR; } + if (rc == NGX_DONE) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "low address bits of %V are meaningless", + &value[0]); + } + cidrin.addr = ntohl(cidrin.addr); cidrin.mask = ntohl(cidrin.mask); } |