From 67b76c5a1de914d19b21c8ac4803c6a7c56692d7 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Mon, 8 Dec 2014 08:49:55 +0000 Subject: MFH: r374162 Add local patch to fix the build on FreeBSD 8. FreeBSD 8 does not have support for the TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT options (the values are always hardcoded). We can fix it by only calling setsockopt(2) with those options if they are defined. At least for now, I have decided not to upstream this change because it basically affects only FreeBSD 8 these days (the other BSDs, Linux and OS X have had support for those options for many years). Approved by: ports-secteam (delphij) --- net/krdc/files/patch-vnc__vncclientthread.cpp | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 net/krdc/files/patch-vnc__vncclientthread.cpp diff --git a/net/krdc/files/patch-vnc__vncclientthread.cpp b/net/krdc/files/patch-vnc__vncclientthread.cpp new file mode 100644 index 000000000000..55f3adfe12b8 --- /dev/null +++ b/net/krdc/files/patch-vnc__vncclientthread.cpp @@ -0,0 +1,40 @@ +Only use TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT if they exist. + +These options are present only in FreeBSD 9+, so we need this patch to maintain +compatibility with FreeBSD 8. + +Not worth upstreaming, as OS X, Linux, NetBSD, OpenBSD and DragonFlyBSD have +had these options for much longer than us. +--- vnc/vncclientthread.cpp ++++ vnc/vncclientthread.cpp +@@ -606,23 +606,30 @@ void VncClientThread::clientSetKeepalive() + return; + } + ++#ifdef TCP_KEEPIDLE + optval = m_keepalive.intervalSeconds; + if (setsockopt(cl->sock, IPPROTO_TCP, TCP_KEEPIDLE, &optval, optlen) < 0) { + kError(5011) << "setsockopt(TCP_KEEPIDLE)" << strerror(errno); + return; + } ++#endif + ++#ifdef TCP_KEEPINTVL + optval = m_keepalive.intervalSeconds; + if (setsockopt(cl->sock, IPPROTO_TCP, TCP_KEEPINTVL, &optval, optlen) < 0) { + kError(5011) << "setsockopt(TCP_KEEPINTVL)" << strerror(errno); + return; + } ++#endif + ++#ifdef TCP_KEEPCNT + optval = m_keepalive.failedProbes; + if(setsockopt(cl->sock, IPPROTO_TCP, TCP_KEEPCNT, &optval, optlen) < 0) { + kError(5011) << "setsockopt(TCP_KEEPCNT)" << strerror(errno); + return; + } ++#endif ++ + m_keepalive.set = true; + kDebug(5011) << "TCP keepalive set"; + } -- cgit v1.2.3