Mercurial > hg > nginx
diff src/http/modules/ngx_http_geo_module.c @ 1380:b590a528fd41
ignore meaningless bits in CIDR and warn about them
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 10 Aug 2007 13:13:28 +0000 |
parents | e958b3cab51a |
children | 03341711f9a2 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_geo_module.c Thu Aug 09 15:28:17 2007 +0000 +++ b/src/http/modules/ngx_http_geo_module.c Fri Aug 10 13:13:28 2007 +0000 @@ -212,12 +212,20 @@ 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); }