projects
/
nginx.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
upstream nginx-0.7.39
[nginx.git]
/
nginx
/
src
/
http
/
modules
/
ngx_http_realip_module.c
diff --git
a/nginx/src/http/modules/ngx_http_realip_module.c
b/nginx/src/http/modules/ngx_http_realip_module.c
index
58bdeeb
..
b069a1e
100644
(file)
--- a/
nginx/src/http/modules/ngx_http_realip_module.c
+++ b/
nginx/src/http/modules/ngx_http_realip_module.c
@@
-282,7
+282,7
@@
ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_int_t rc;
ngx_str_t *value;
ngx_int_t rc;
ngx_str_t *value;
- ngx_
inet_cidr_t in_
cidr;
+ ngx_
cidr_t
cidr;
ngx_http_realip_from_t *from;
if (rlcf->from == NULL) {
ngx_http_realip_from_t *from;
if (rlcf->from == NULL) {
@@
-300,7
+300,7
@@
ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
value = cf->args->elts;
value = cf->args->elts;
- rc = ngx_ptocidr(&value[1], &
in_
cidr);
+ rc = ngx_ptocidr(&value[1], &cidr);
if (rc == NGX_ERROR) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid parameter \"%V\"",
if (rc == NGX_ERROR) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid parameter \"%V\"",
@@
-308,13
+308,19
@@
ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_ERROR;
}
return NGX_CONF_ERROR;
}
+ if (cidr.family != AF_INET) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"realip_from\" supports IPv4 only");
+ 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[1]);
}
if (rc == NGX_DONE) {
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"low address bits of %V are meaningless", &value[1]);
}
- from->mask =
in_cidr
.mask;
- from->addr =
in_cidr
.addr;
+ from->mask =
cidr.u.in
.mask;
+ from->addr =
cidr.u.in
.addr;
return NGX_CONF_OK;
}
return NGX_CONF_OK;
}