diff options
author | Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi> | 2011-02-15 10:19:06 +0200 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2011-02-15 23:55:45 +0100 |
commit | ea605530c4fbfd86fb0ee9026eb219d68dd47360 (patch) | |
tree | 026d43d1002b085925fefc387b3980f470a59580 /setup.cpp | |
parent | 76a4acdb380b0b3d78cdc7bb149e5f96b2cabf63 (diff) | |
download | vdr-plugin-live-ea605530c4fbfd86fb0ee9026eb219d68dd47360.tar.gz vdr-plugin-live-ea605530c4fbfd86fb0ee9026eb219d68dd47360.tar.bz2 |
Changed default addresses to use bindv6only status.
Diffstat (limited to 'setup.cpp')
-rw-r--r-- | setup.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -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; |