aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_realip_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-02-24 14:01:40 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-02-24 14:01:40 +0000
commit36860101ec7a3de1d337ecb6f8f3e2bfd0fb63cb (patch)
tree51e1a9c70379dc2ba60ad3638d4cecfdde21a7e5 /src/http/modules/ngx_http_realip_module.c
parent1f4220ee869152938d9140c471c37be628532344 (diff)
downloadnginx-36860101ec7a3de1d337ecb6f8f3e2bfd0fb63cb.tar.gz
nginx-36860101ec7a3de1d337ecb6f8f3e2bfd0fb63cb.zip
prepare ngx_ptocidr() for IPv6
Diffstat (limited to 'src/http/modules/ngx_http_realip_module.c')
-rw-r--r--src/http/modules/ngx_http_realip_module.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/http/modules/ngx_http_realip_module.c b/src/http/modules/ngx_http_realip_module.c
index 58bdeeb37..b069a1eba 100644
--- a/src/http/modules/ngx_http_realip_module.c
+++ b/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_inet_cidr_t in_cidr;
+ ngx_cidr_t cidr;
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;
- 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\"",
@@ -308,13 +308,19 @@ ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
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]);
}
- 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;
}