Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Dec 2014 23:03:58 +0000 (UTC)
From:      Raphael Kubo da Costa <rakuco@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r374162 - head/net/krdc/files
Message-ID:  <201412062303.sB6N3wGP095853@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rakuco
Date: Sat Dec  6 23:03:57 2014
New Revision: 374162
URL: https://svnweb.freebsd.org/changeset/ports/374162
QAT: https://qat.redports.org/buildarchive/r374162/

Log:
  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).
  
  MFH:		2014Q4

Added:
  head/net/krdc/files/
  head/net/krdc/files/patch-vnc__vncclientthread.cpp   (contents, props changed)

Added: head/net/krdc/files/patch-vnc__vncclientthread.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/krdc/files/patch-vnc__vncclientthread.cpp	Sat Dec  6 23:03:57 2014	(r374162)
@@ -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";
+ }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412062303.sB6N3wGP095853>