summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2015-09-14 22:06:52 +0200
committerMichael Adam <obnox@samba.org>2015-10-14 10:27:46 +0200
commit1db61302b6036bdfabf0e3a1507e0e5573a57368 (patch)
treec3e4f4ad59146e8842c5cde292f338796983c7b9
parente9e0dac6d719304af8174f4b9119709afe71f508 (diff)
downloadsocket_wrapper-1db61302b6036bdfabf0e3a1507e0e5573a57368.tar.gz
socket_wrapper-1db61302b6036bdfabf0e3a1507e0e5573a57368.tar.xz
socket_wrapper-1db61302b6036bdfabf0e3a1507e0e5573a57368.zip
swrap: Add support for TCP_NODELAY in getsockopt()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r--src/socket_wrapper.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 527ba21..aad5f3e 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -3351,6 +3351,29 @@ static int swrap_getsockopt(int s, int level, int optname,
optval,
optlen);
}
+ } else if (level == IPPROTO_TCP) {
+ switch (optname) {
+#ifdef TCP_NODELAY
+ case TCP_NODELAY:
+ /*
+ * This enables sending packets directly out over TCP.
+ * As a unix socket is doing that any way, report it as
+ * enabled.
+ */
+ if (optval == NULL || optlen == NULL ||
+ *optlen < (socklen_t)sizeof(int)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ *optlen = sizeof(int);
+ *(int *)optval = si->tcp_nodelay;
+
+ return 0;
+#endif /* TCP_NODELAY */
+ default:
+ break;
+ }
}
errno = ENOPROTOOPT;