From 69fe64c277a3827e3ee50b37eb66f0ebedfa0b27 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sun, 20 Mar 2011 12:19:39 +0100 Subject: [PATCH] Honour IPv6 config option for HTTP services --- src/httpd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/httpd.c b/src/httpd.c index 13014416..813e9a88 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -1200,10 +1200,13 @@ int httpd_init(void) { unsigned short port; + int v6enabled; int ret; httpd_exit = 0; + v6enabled = cfg_getbool(cfg_getsec(cfg, "general"), "ipv6"); + evbase_httpd = event_base_new(); if (!evbase_httpd) { @@ -1288,9 +1291,12 @@ httpd_init(void) goto bind_fail; } - ret = evhttp_bind_socket(evhttpd, "::", port); - if (ret < 0) - DPRINTF(E_WARN, L_HTTPD, "Could not bind IN6ADDR_ANY:%d (that's OK)\n", port); + if (v6enabled) + { + ret = evhttp_bind_socket(evhttpd, "::", port); + if (ret < 0) + DPRINTF(E_WARN, L_HTTPD, "Could not bind IN6ADDR_ANY:%d (that's OK)\n", port); + } evhttp_set_gencb(evhttpd, httpd_gen_cb, NULL);