summaryrefslogtreecommitdiff
path: root/setup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'setup.cpp')
-rw-r--r--setup.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/setup.cpp b/setup.cpp
index 9778805..e4ce647 100644
--- a/setup.cpp
+++ b/setup.cpp
@@ -191,9 +191,21 @@ namespace {
bool Setup::CheckServerIps()
{
if ( m_serverIps.empty() ) {
- // add a default IPv4 listener address
- m_serverIps.push_back( "0.0.0.0" );
- // and be prepared for IPv6 only hosts.
+ bool bindv6only = false;
+ FILE* f = fopen("/proc/sys/net/ipv6/bindv6only", "r");
+ if (f) {
+ int c = fgetc(f);
+ if (c != EOF) {
+ bindv6only = c - '0';
+ }
+ fclose(f);
+ f = NULL;
+ }
+ esyslog( "[live] INFO: bindv6only=%d", bindv6only);
+ cerr << "INFO: bindv6only=" << bindv6only << endl;
+ // add a default IPv4 listener address if default IPv6 one will be binded only to v6
+ if (bindv6only)
+ m_serverIps.push_back( "0.0.0.0" );
m_serverIps.push_back( "::" );
// we assume these are ok :)
return true;