summaryrefslogtreecommitdiff
path: root/lib/sockopt.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-02-07 23:03:37 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-02-07 23:03:37 +0200
commit65497556eda9ce413e8c9f88479aa57957266265 (patch)
tree80a8f8b926d24e23f85183701c5ebb2ca00a6c8f /lib/sockopt.c
parent7fe05d6185d6c5846ef56eb767aef77b5629dff5 (diff)
bgpd: Do not show TCP MSS if the socket is broken
Just avoid calling for TCP MSS socket option if it's not in use. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'lib/sockopt.c')
-rw-r--r--lib/sockopt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sockopt.c b/lib/sockopt.c
index b9b9a71167..74bc034ccd 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -672,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) {