]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
Ignore socket options not supported by LWIP
authorMarco Schlumpp <marco@unikraft.io>
Fri, 2 Feb 2024 10:07:21 +0000 (11:07 +0100)
committerRazvan Deaconescu <razvan.deaconescu@upb.ro>
Tue, 6 Feb 2024 21:53:39 +0000 (23:53 +0200)
For IP_RECVERR never returning the error structures that the option
enables is a valid implementation. A proper implementation would require
changes to the LWIP codebase. For TCP_FASTOPEN, it would only improve
the latency and therefore we can safely ignore the option.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Mihnea Firoiu <mihneafiroiu0@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #46

sockets.c

index 1af7a94fad1f83b9490624bb3322a2aa1309483c..3af5daaebc54a725402bf3c2128df327d698b5d5 100644 (file)
--- a/sockets.c
+++ b/sockets.c
@@ -209,6 +209,9 @@ lwip_posix_socket_getsockopt(posix_sock *file, int level,
        return ret;
 }
 
+#define LINUX_SOL_TCP 6
+#define LINUX_TCP_FASTOPEN 23
+
 static int
 lwip_posix_socket_setsockopt(posix_sock *file, int level,
                             int optname, const void *optval, socklen_t optlen)
@@ -219,6 +222,11 @@ lwip_posix_socket_setsockopt(posix_sock *file, int level,
        lwip_fd = _lwip_getfd(file);
        UK_ASSERT(lwip_fd >= 0);
 
+       if ((level == LINUX_SOL_TCP && optname == LINUX_TCP_FASTOPEN) ||
+           (level == SOL_IP && optname == IP_RECVERR)) {
+               /* Ignore stuff that LWIP doesn't support */
+               return 0;
+       }
        ret = lwip_setsockopt(lwip_fd, level, optname, optval, optlen);
        if (unlikely(ret < 0))
                ret = -errno;