summaryrefslogtreecommitdiff
path: root/setup.cpp
diff options
context:
space:
mode:
authorRolf Ahrenberg <Rolf.Ahrenberg@sci.fi>2011-02-15 10:19:06 +0200
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2011-02-15 23:55:45 +0100
commitea605530c4fbfd86fb0ee9026eb219d68dd47360 (patch)
tree026d43d1002b085925fefc387b3980f470a59580 /setup.cpp
parent76a4acdb380b0b3d78cdc7bb149e5f96b2cabf63 (diff)
downloadvdr-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.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;