summaryrefslogtreecommitdiffstats
path: root/lib/sockopt.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:32 +0000
commit35cadacd2bb9383686753731e31bd7e145fb2506 (patch)
tree4489adbde75a837989533837185b2b8369a0bf68 /lib/sockopt.c
parentAdding debian version 9.1-0.1. (diff)
downloadfrr-35cadacd2bb9383686753731e31bd7e145fb2506.tar.xz
frr-35cadacd2bb9383686753731e31bd7e145fb2506.zip
Merging upstream version 10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/sockopt.c')
-rw-r--r--lib/sockopt.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c
index 41fcc41..74bc034 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -10,13 +10,12 @@
#include "sockunion.h"
#include "lib_errors.h"
-#if (defined(__FreeBSD__) \
- && ((__FreeBSD_version >= 500022 && __FreeBSD_version < 700000) \
- || (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) \
- || (defined(__NetBSD__) && defined(__NetBSD_Version__) \
- && __NetBSD_Version__ >= 106010000) \
- || defined(__OpenBSD__) || defined(__APPLE__) \
- || defined(__DragonFly__) || defined(__sun)
+#if (defined(__FreeBSD__) && \
+ ((__FreeBSD_version >= 500022 && __FreeBSD_version < 700000) || \
+ (__FreeBSD_version < 500000 && __FreeBSD_version >= 440000))) || \
+ (defined(__NetBSD__) && defined(__NetBSD_Version__) && \
+ __NetBSD_Version__ >= 106010000) || \
+ defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun)
#define HAVE_BSD_STRUCT_IP_MREQ_HACK
#endif
@@ -673,6 +672,9 @@ int sockopt_tcp_mss_get(int sock)
int tcp_maxseg = 0;
socklen_t tcp_maxseg_len = sizeof(tcp_maxseg);
+ if (sock < 0)
+ return 0;
+
ret = getsockopt(sock, IPPROTO_TCP, TCP_MAXSEG, &tcp_maxseg,
&tcp_maxseg_len);
if (ret != 0) {