Index: conf.c
===================================================================
--- conf.c	(revisión: 453)
+++ conf.c	(copia de trabajo)
@@ -86,6 +86,7 @@
     ffmpeg_bps:                     DEF_FFMPEG_BPS,
     ffmpeg_vbr:                     DEF_FFMPEG_VBR,
     ffmpeg_video_codec:             DEF_FFMPEG_CODEC,
+    ipv6_enabled:                   0,
     stream_port:                    0,
     stream_quality:                 50,
     stream_motion:                  0,
@@ -932,6 +933,17 @@
     },
 #endif /* HAVE_FFMPEG */
     {
+    "ipv6_enabled",
+    "\n############################################################\n"
+    "# Global Network Options\n"
+    "############################################################\n\n"
+    "# Enable or disable IPV6 for http control and stream (default: 0 = disabled)",
+    0,
+    CONF_OFFSET(ipv6_enabled),
+    copy_int,
+    print_int
+    },
+    {
     "stream_port",
     "\n############################################################\n"
     "# Live Stream Server\n"
@@ -1020,7 +1032,7 @@
     CONF_OFFSET(webcontrol_authentication),
     copy_string,
     print_string
-    },    
+    },   
     {
     "track_type",
     "\n############################################################\n"
Index: conf.h
===================================================================
--- conf.h	(revisión: 453)
+++ conf.h	(copia de trabajo)
@@ -62,6 +62,7 @@
     int ffmpeg_vbr;
     int ffmpeg_deinterlace;
     const char *ffmpeg_video_codec;
+    int ipv6_enabled;
     int stream_port;
     int stream_quality;
     int stream_motion;
Index: motion.h
===================================================================
--- motion.h	(revisión: 453)
+++ motion.h	(copia de trabajo)
@@ -422,7 +422,7 @@
 /* TLS keys below */
 extern pthread_key_t tls_key_threadnr; /* key for thread number */
 
-int http_bindsock(int, int);
+int http_bindsock(int, int, int);
 void * mymalloc(size_t);
 void * myrealloc(void *, size_t, const char *);
 FILE * myfopen(const char *, const char *, size_t);
Index: motion-dist.conf.in
===================================================================
--- motion-dist.conf.in	(revisión: 453)
+++ motion-dist.conf.in	(copia de trabajo)
@@ -424,6 +424,11 @@
 # File extension .mpg is automatically added so do not include this
 timelapse_filename %Y%m%d-timelapse
 
+############################################################
+# Global Network Options
+############################################################
+# Enable or disable IPV6 for http control and stream (default: 0 = disabled)
+ipv6_enabled 0
 
 ############################################################
 # Live Stream Server
Index: webhttpd.c
===================================================================
--- webhttpd.c	(revisión: 453)
+++ webhttpd.c	(copia de trabajo)
@@ -2368,7 +2368,10 @@
 #if defined(BSD)
     hints.ai_family = AF_INET;
 #else
-    hints.ai_family    = AF_UNSPEC;
+    if (!cnt[0]->conf.ipv6_enabled)
+        hints.ai_family = AF_INET;
+    else
+        hints.ai_family = AF_UNSPEC;
 #endif
     hints.ai_socktype = SOCK_STREAM;
 
Index: stream.c
===================================================================
--- stream.c	(revisión: 453)
+++ stream.c	(copia de trabajo)
@@ -33,7 +33,7 @@
  * If the parameter _local_ is not zero the socket is setup to only accept connects from localhost.
  * Otherwise any client IP address is accepted. The function returns an integer representing the socket.
  */
-int http_bindsock(int port, int local)
+int http_bindsock(int port, int local, int ipv6_enabled)
 {
     int sl = -1, optval;
     struct addrinfo hints, *res = NULL, *ressave = NULL;
@@ -48,7 +48,10 @@
 #if defined(BSD)
     hints.ai_family = AF_INET;
 #else
-    hints.ai_family = AF_UNSPEC;
+    if (!ipv6_enabled)
+        hints.ai_family = AF_INET;
+    else
+        hints.ai_family = AF_UNSPEC;
 #endif
     hints.ai_socktype = SOCK_STREAM;
 
@@ -328,7 +331,7 @@
  */
 int stream_init(struct context *cnt)
 {
-    cnt->stream.socket = http_bindsock(cnt->conf.stream_port, cnt->conf.stream_localhost);
+    cnt->stream.socket = http_bindsock(cnt->conf.stream_port, cnt->conf.stream_localhost, cnt->conf.ipv6_enabled);
     cnt->stream.next = NULL;
     cnt->stream.prev = NULL;
     return cnt->stream.socket;
