From 8a56531c90c37f90bdbf53089b94a5129a034045 Mon Sep 17 00:00:00 2001
From: kytv <kytv@mail.i2p>
Date: Wed, 1 Jun 2011 14:42:18 +0000
Subject: [PATCH] Don't prefer IPv4 but add the option commented out to
 wrapper.config. Make the option configurable in runplain.sh

---
 installer/resources/runplain.sh    |  6 +++++-
 installer/resources/wrapper.config | 10 +++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/installer/resources/runplain.sh b/installer/resources/runplain.sh
index 6e1af883f8..a6f76537fa 100644
--- a/installer/resources/runplain.sh
+++ b/installer/resources/runplain.sh
@@ -14,9 +14,13 @@
 I2P="%INSTALL_PATH"
 I2PTEMP="%SYSTEM_java_io_tmpdir"
 
+# Having IPv6 enabled can cause problems with certain configurations. Changing the
+# next value to true may help. 
+PREFERv4="false"
+
 export CP="${I2P}" ; for j in "${I2P}/lib/*"  ; do export CP="${CP}:${j}" ; done;
 JAVA=java
 
-JAVAOPTS="-Djava.net.preferIPv4Stack=true -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -DloggerFilenameOverride=logs/log-router-@.txt"
+JAVAOPTS="-Djava.net.preferIPv4Stack=${PREFERv4} -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -DloggerFilenameOverride=logs/log-router-@.txt"
 nohup ${JAVA} -cp "${CP}" ${JAVAOPTS} net.i2p.router.RouterLaunch > /dev/null 2>&1 &
 echo $! > "${I2PTEMP}/router.pid"
diff --git a/installer/resources/wrapper.config b/installer/resources/wrapper.config
index e7e531248a..2a459d6d4a 100644
--- a/installer/resources/wrapper.config
+++ b/installer/resources/wrapper.config
@@ -60,7 +60,15 @@ wrapper.java.additional.2=-Dorg.mortbay.http.Version.paranoid=true
 wrapper.java.additional.3=-Dorg.mortbay.xml.XmlParser.NotValidating=true
 wrapper.java.additional.4=-Di2p.dir.base="$INSTALL_PATH"
 wrapper.java.additional.4.stripquotes=TRUE
-wrapper.java.additional.5=-Djava.net.preferIPv4Stack=true
+
+# On some IPv6 enabled systems, I2P and other network-enabled java applications
+# may fail to start. For examples see
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560044. 
+# Two things that may help if you experience this issue
+# 1) "echo 0 > /proc/sys/net/ipv6/bindv6only" as root; or
+# 2) uncomment the following line:
+#wrapper.java.additional.5=-Djava.net.preferIPv4Stack=true
+
 # Jetty says this is a security risk
 # Uncommenting this won't help as the router forces it to true
 # If you really need this, you have to set it in jetty.xml
-- 
GitLab