summaryrefslogtreecommitdiffstats
path: root/lib/sockopt.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:31 +0000
commitacb594b1d825c6e12369cebb941968ec08c840ce (patch)
treed544788908e7353a4f117e2991f15f4236a0c963 /lib/sockopt.c
parentAdding upstream version 9.1. (diff)
downloadfrr-acb594b1d825c6e12369cebb941968ec08c840ce.tar.xz
frr-acb594b1d825c6e12369cebb941968ec08c840ce.zip
Adding upstream version 10.0.upstream/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) {