1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-03 06:04:53 +00:00

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
This commit is contained in:
Raphael Kubo da Costa 2014-12-06 23:03:57 +00:00
parent a467f03df0
commit 885c532f8e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=374162

View File

@ -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";
}