From: William Dauchy Date: Wed, 12 Feb 2020 14:53:04 +0000 (+0100) Subject: BUG/MINOR: tcp: don't try to set defaultmss when value is negative X-Git-Tag: v2.2-dev3~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=97a7bdac3e9e64e9f128943ee3d7b48de88a7daf;p=thirdparty%2Fhaproxy.git BUG/MINOR: tcp: don't try to set defaultmss when value is negative when `getsockopt` previously failed, we were trying to set defaultmss with -2 value. this is a followup of github issue #499 this should be backported to all versions >= v1.8 Fixes: 153659f1ae69a1 ("MINOR: tcp: When binding socket, attempt to reuse one from the old proc.") Signed-off-by: William Dauchy --- diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 45d6a7c199..7668ec29c3 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -906,9 +906,9 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) defaultmss = default_tcp6_maxseg; getsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &tmpmaxseg, &len); - if (tmpmaxseg != defaultmss && setsockopt(fd, IPPROTO_TCP, - TCP_MAXSEG, &defaultmss, - sizeof(defaultmss)) == -1) { + if (defaultmss > 0 && + tmpmaxseg != defaultmss && + setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &defaultmss, sizeof(defaultmss)) == -1) { msg = "cannot set MSS"; err |= ERR_WARN; }