comparison 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
comparison
equal deleted inserted replaced
1379:cc8ac1936aa4 1380:b590a528fd41
210 if (ngx_strcmp(value[0].data, "default") == 0) { 210 if (ngx_strcmp(value[0].data, "default") == 0) {
211 cidrin.addr = 0; 211 cidrin.addr = 0;
212 cidrin.mask = 0; 212 cidrin.mask = 0;
213 213
214 } else { 214 } else {
215 if (ngx_ptocidr(&value[0], &cidrin) == NGX_ERROR) { 215 rc = ngx_ptocidr(&value[0], &cidrin);
216
217 if (rc == NGX_ERROR) {
216 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 218 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
217 "invalid parameter \"%V\"", &value[0]); 219 "invalid parameter \"%V\"", &value[0]);
218 return NGX_CONF_ERROR; 220 return NGX_CONF_ERROR;
221 }
222
223 if (rc == NGX_DONE) {
224 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
225 "low address bits of %V are meaningless",
226 &value[0]);
219 } 227 }
220 228
221 cidrin.addr = ntohl(cidrin.addr); 229 cidrin.addr = ntohl(cidrin.addr);
222 cidrin.mask = ntohl(cidrin.mask); 230 cidrin.mask = ntohl(cidrin.mask);
223 } 231 }