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 <w.dauchy@criteo.com>
(cherry picked from commit 97a7bdac3e9e64e9f128943ee3d7b48de88a7daf)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 7fc2d0efbbd443206441f8a766b4b61123ac3724)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 8bdaf93..502e736 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -989,9 +989,9 @@
 			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;
 		}