Opened 7 years ago

Last modified 3 years ago

#1306 new enhancement

ngx_http_geo_module ranges do not support ipv6

Reported by: ajorgensen@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.9.x
Keywords: geo Cc:
uname -a: Linux 122d01e8a792 4.4.0-79-generic #100~14.04.1-Ubuntu SMP Fri May 19 18:36:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.8.1
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
built with OpenSSL 1.0.1 14 Mar 2012
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed' --with-ipv6

Description

It appears that while ipv6 is supported via CIDR in the geo module, ranges for ipv6 address are not supported and will return an error claiming an invalid range.

The documentation does not seem to give any indication that only CIDR is supported for ipv6 so I am not sure if this is just a code path that was not upgrade to support ipv6 or if the implementation itself does not support the ability to check that an ipv6 address is in a range.

I am looking to use geo to identify a mix of ipv4 and ipv6 ip ranges that do not fit well into a CIDR block so expressing them as such is difficult. It would be great if nginx would support ipv6 ranges as well so that all of the ip address can be defined in the same geo block.

Example:
geo $matcher {

ranges;
default 0;
192.168.0.0-192.168.255.255 US;
2001::-2001:ffff:ffff:ffff:ffff:ffff:ffff:ffff US;

}
2017/06/29 20:15:52 [emerg] 520#0: invalid range "2001::-2001:ffff:ffff:ffff:ffff:ffff:ffff:ffff" in /etc/nginx/conf.d/test.conf:14
nginx: [emerg] invalid range "2001::-2001:ffff:ffff:ffff:ffff:ffff:ffff:ffff" in /etc/nginx/conf.d/test.conf:14
nginx: configuration file /etc/nginx/nginx.conf test failed

Change History (3)

comment:1 by Maxim Dounin, 7 years ago

Priority: majorminor
Type: defectenhancement

As of now, only IPv4 ranges are supported by the code.

comment:2 by ajorgensen@…, 7 years ago

Sounds good. I think it would be helpful to document this in the official documentation, currently there is no indication that ipv6 ranges are not supported which is pretty confusing.

I'd be happy to add it to the documentation but I actually cant seem to find the documentation for the ngx_http_geo_module in the nginx repository or the nginx-wiki repository. Do you have a link to where that documentation lives?

Last edited 7 years ago by ajorgensen@… (previous) (diff)

comment:3 by Sannis@…, 3 years ago

This will be great feature for nginx users with large geo maps, especially if nginx will support binary file caching for IPv6 ranges.

Note: See TracTickets for help on using tickets.