summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport/socket/src/socket.c
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2016-07-11 11:52:41 +0200
committerJeff Darcy <jdarcy@redhat.com>2016-07-12 05:07:29 -0700
commita2c96bebcda9d49a0fea9d3e0b284669f65d1b4b (patch)
treebdd78274797b291b7d6722c0c821c8cf13cd3917 /rpc/rpc-transport/socket/src/socket.c
parent5cdeeb9d345b24bab4d917724870f3aae89d8369 (diff)
rpc: invalid argument when function setsockopt sets option TCP_USER_TIMEOUT
If option "transport.tcp-user-timeout" hasn't been setted, glusterd's priv->timeout will be -1, which will cause invalid argument when set TCP_USER_TIMEOUT. Cherry picked from commit b2c73cbf423de6201f956f522b7429615c88869d: > Change-Id: Ibc16264ceac0e69ab4a217ffa27c549b9fa21df9 > BUG: 1349657 > Signed-off-by: Zhou Zhengping <johnzzpcrystal@gmail.com> > Reviewed-on: http://review.gluster.org/14785 > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Smoke: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Change-Id: Ibc16264ceac0e69ab4a217ffa27c549b9fa21df9 BUG: 1354405 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/14888 Reviewed-by: Zhou Zhengping <johnzzpcrystal@gmail.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'rpc/rpc-transport/socket/src/socket.c')
-rw-r--r--rpc/rpc-transport/socket/src/socket.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 209d89a225b..de222c766c7 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -971,6 +971,8 @@ __socket_keepalive (int fd, int family, int keepalive_intvl,
}
#if defined(TCP_USER_TIMEOUT)
+ if (timeout_ms < 0)
+ goto done;
ret = setsockopt (fd, IPPROTO_TCP , TCP_USER_TIMEOUT, &timeout_ms,
sizeof (timeout_ms));
if (ret == -1) {