diff options
author | Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi> | 2011-02-22 00:32:30 +0200 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2011-02-22 00:42:07 +0100 |
commit | 118c2aa7306fba7481e619ef916e5ecc05577695 (patch) | |
tree | e65da8d3a1cec229c60553d2ae927d18e99d2de3 /setup.cpp | |
parent | 45ff354dd802a9994d676eafff14499fd91d1946 (diff) | |
download | vdr-plugin-live-118c2aa7306fba7481e619ef916e5ecc05577695.tar.gz vdr-plugin-live-118c2aa7306fba7481e619ef916e5ecc05577695.tar.bz2 |
Fixed interface binding on IPv4 only systems.
Diffstat (limited to 'setup.cpp')
-rw-r--r-- | setup.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -191,23 +191,24 @@ namespace { bool Setup::CheckServerIps() { if ( m_serverIps.empty() ) { - bool bindv6only = false; FILE* f = fopen("/proc/sys/net/ipv6/bindv6only", "r"); if (f) { + bool bindv6only = false; int c = fgetc(f); if (c != EOF) { bindv6only = c - '0'; } fclose(f); f = NULL; + esyslog( "[live] INFO: bindv6only=%d", bindv6only); + // add a default IPv6 listener address + m_serverIps.push_back( "::" ); + // skip the default IPv4 listener address if IPv6 one will be binded also to v4 + if (!bindv6only) + return true; } - 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( "::" ); + // add a default IPv4 listener address + m_serverIps.push_back( "0.0.0.0" ); // we assume these are ok :) return true; } |