]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Allow setsockopt functions to return size set
authorDonald Sharp <sharpd@nvidia.com>
Tue, 3 Dec 2024 23:38:59 +0000 (18:38 -0500)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Wed, 4 Dec 2024 12:47:34 +0000 (12:47 +0000)
When finding a send/receive buffer size that is usable
let's report how big we were able to set it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit d5615fd6f84e643f194be8c3e91343b35585eb9c)

lib/sockopt.c
lib/sockopt.h

index 74bc034ccd7522bbb4e7807d4945645388507949..003ddb72dc2d30939c2e9b9cb4fa2cb862ad943d 100644 (file)
@@ -19,7 +19,7 @@
 #define HAVE_BSD_STRUCT_IP_MREQ_HACK
 #endif
 
-void setsockopt_so_recvbuf(int sock, int size)
+int setsockopt_so_recvbuf(int sock, int size)
 {
        int orig_req = size;
 
@@ -34,9 +34,11 @@ void setsockopt_so_recvbuf(int sock, int size)
                flog_err(EC_LIB_SOCKET,
                         "%s: fd %d: SO_RCVBUF set to %d (requested %d)",
                         __func__, sock, size, orig_req);
+
+       return size;
 }
 
-void setsockopt_so_sendbuf(const int sock, int size)
+int setsockopt_so_sendbuf(const int sock, int size)
 {
        int orig_req = size;
 
@@ -51,6 +53,8 @@ void setsockopt_so_sendbuf(const int sock, int size)
                flog_err(EC_LIB_SOCKET,
                         "%s: fd %d: SO_SNDBUF set to %d (requested %d)",
                         __func__, sock, size, orig_req);
+
+       return size;
 }
 
 int getsockopt_so_sendbuf(const int sock)
index e6fb78d5e4efac03e699090ec059be37b257040b..cbf988cbe7183d4ba03875595401a9342e0361ce 100644 (file)
@@ -12,8 +12,8 @@
 extern "C" {
 #endif
 
-extern void setsockopt_so_recvbuf(int sock, int size);
-extern void setsockopt_so_sendbuf(const int sock, int size);
+extern int setsockopt_so_recvbuf(int sock, int size);
+extern int setsockopt_so_sendbuf(const int sock, int size);
 extern int getsockopt_so_sendbuf(const int sock);
 extern int getsockopt_so_recvbuf(const int sock);