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 <w.dau...@criteo.com> --- src/proto_tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proto_tcp.c b/src/proto_tcp.c index a9d5229c9..e509a17bc 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; } -- 2.25.0