comparison src/http/modules/ngx_http_geo_module.c @ 1507:1593532dcc35 stable-0.5

r1381 merge: ignore meaningless bits in CIDR and warn about them
author Igor Sysoev <igor@sysoev.ru>
date Sat, 22 Sep 2007 19:02:39 +0000
parents e60fe4cf1d4e
children bf7814d77484
comparison
equal deleted inserted replaced
1506:1a1fe29fdb17 1507:1593532dcc35
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 }