From: Dave H. <hel...@us...> - 2013-05-29 02:02:36
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "sfcb - Small Footprint CIM Broker". The branch, master has been updated via 93e62db29de3c509788a7d7c4be78705fe2162d8 (commit) from 2e68c1a981197cca8f64490dcef9021da1c44e74 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 93e62db29de3c509788a7d7c4be78705fe2162d8 Author: Dave Heller <hel...@us...> Date: Tue May 28 22:01:09 2013 -0400 [sfcb-tix:#53] SFCB may not start if runtime does not support IPv6 ----------------------------------------------------------------------- Summary of changes: httpAdapter.c | 2 +- sfcBroker.c | 54 +++++++++++++++++++++++++++++++----------------------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/httpAdapter.c b/httpAdapter.c index c54ddf5..d732875 100644 --- a/httpAdapter.c +++ b/httpAdapter.c @@ -197,7 +197,7 @@ typedef struct _buffer { } Buffer; #ifdef HAVE_IPV6 -static int fallback_ipv4; +extern int fallback_ipv4; #endif #define SET_HDR_CP(member, val) member = val + strspn(val, " \t"); \ diff --git a/sfcBroker.c b/sfcBroker.c index 700d0c3..3d15a2d 100644 --- a/sfcBroker.c +++ b/sfcBroker.c @@ -104,6 +104,10 @@ extern char *configfile; extern char *ip4List; extern char *ip6List; +#ifdef HAVE_IPV6 +int fallback_ipv4 = 1; +#endif + int trimws = 1; typedef struct startedAdapter { @@ -912,31 +916,35 @@ main(int argc, char *argv[]) } } #ifdef HAVE_IPV6 - if (!ip6List) - getControlChars("ip6AddrList",&ip6List); - if (ip6List && !httpLocalOnly) { - char* t = strtok(ip6List,","); - while(t) { - ipAddrList[ipAddrCnt].addrStr = strdup(t); - ipAddrList[ipAddrCnt].addrFam = AF_INET6; - ipAddrCnt++; - t = strtok(NULL,","); - if ((ipAddrList = realloc(ipAddrList,(ipAddrCnt+1)*sizeof(IpAddr))) == 0) { - mlogf(M_ERROR,M_SHOW,"-#- Failed to realloc memory for ipAddrList.\n"); - exit(2); + struct stat buf; + if (stat("/proc/net/tcp6", &buf) == 0 && (buf.st_mode & S_IFMT) == S_IFREG) { + if (!ip6List) + getControlChars("ip6AddrList",&ip6List); + if (ip6List && !httpLocalOnly) { + char* t = strtok(ip6List,","); + while(t) { + ipAddrList[ipAddrCnt].addrStr = strdup(t); + ipAddrList[ipAddrCnt].addrFam = AF_INET6; + ipAddrCnt++; + t = strtok(NULL,","); + if ((ipAddrList = realloc(ipAddrList,(ipAddrCnt+1)*sizeof(IpAddr))) == 0) { + mlogf(M_ERROR,M_SHOW,"-#- Failed to realloc memory for ipAddrList.\n"); + exit(2); + } } } - } - if (ipAddrCnt == 0) { - if (httpLocalOnly) { - mlogf(M_INFO,M_SHOW,"--- Bind to loopback address\n"); - ipAddrList[ipAddrCnt].addrStr = "::1"; - } else { - mlogf(M_INFO,M_SHOW,"--- Bind to any available IP address\n"); - ipAddrList[ipAddrCnt].addrStr = "::"; + if (ipAddrCnt == 0) { + if (httpLocalOnly) { + mlogf(M_INFO,M_SHOW,"--- Bind to loopback address\n"); + ipAddrList[ipAddrCnt].addrStr = "::1"; + } else { + mlogf(M_INFO,M_SHOW,"--- Bind to any available IP address\n"); + ipAddrList[ipAddrCnt].addrStr = "::"; + } + ipAddrList[ipAddrCnt].addrFam = AF_INET6; + ipAddrCnt++; } - ipAddrList[ipAddrCnt].addrFam = AF_INET6; - ipAddrCnt++; + fallback_ipv4 = 0; } #endif if (ipAddrCnt == 0) { @@ -947,7 +955,7 @@ main(int argc, char *argv[]) mlogf(M_INFO,M_SHOW,"--- Bind to any available IP address\n"); ipAddrList[ipAddrCnt].addrStr = "0.0.0.0"; } - ipAddrList[ipAddrCnt].addrFam = AF_INET6; + ipAddrList[ipAddrCnt].addrFam = AF_INET; ipAddrCnt++; } #endif // LOCAL_CONNECT_ONLY_ENABLE hooks/post-receive -- sfcb - Small Footprint CIM Broker |