aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-03-13 14:20:34 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-03-13 14:20:34 +0000
commit6d94b51f0bda79fba3a9d122537f0cfac412bb34 (patch)
treecb97419433f565c89dcc7a4d1f93a322fea9d2a0 /src/http/ngx_http_core_module.c
parent648b0dcf282a3f1b75acfb9775c7fb00821454b9 (diff)
downloadnginx-6d94b51f0bda79fba3a9d122537f0cfac412bb34.tar.gz
nginx-6d94b51f0bda79fba3a9d122537f0cfac412bb34.zip
ipv6only
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index a2d4e8688..2c3992b56 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -3332,6 +3332,45 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
continue;
}
+ if (ngx_strncmp(value[n].data, "ipv6only=o", 10) == 0) {
+#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+ struct sockaddr *sa;
+
+ sa = (struct sockaddr *) ls->sockaddr;
+
+ if (sa->sa_family == AF_INET6) {
+
+ if (ngx_strcmp(&value[n].data[10], "n") == 0) {
+ ls->conf.ipv6only = 1;
+
+ } else if (ngx_strcmp(&value[n].data[10], "ff") == 0) {
+ ls->conf.ipv6only = 2;
+
+ } else {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid ipv6only flags \"%s\"",
+ &value[n].data[9]);
+ return NGX_CONF_ERROR;
+ }
+
+ ls->conf.bind = 1;
+
+ } else {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "ipv6only is not supported "
+ "on addr \"%s\", ignored",
+ ls->conf.addr);
+ }
+
+ continue;
+#else
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "bind ipv6only is not supported "
+ "on this platform");
+ return NGX_CONF_ERROR;
+#endif
+ }
+
if (ngx_strcmp(value[n].data, "ssl") == 0) {
#if (NGX_HTTP_SSL)
ls->conf.ssl = 1;