From dca5c71e533d3374d98c6c374aefeca375191eb7 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sun, 24 Dec 2023 19:04:49 +0200 Subject: [PATCH] Kernel: Stub out getsockopt for the SO_REUSEADDR option We currently discard setsockopt for SO_REUSEADDR, so to ensure consistency, support getsockopt as well. --- Kernel/Net/Socket.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp index e8e7bedde5..d9ba096c4f 100644 --- a/Kernel/Net/Socket.cpp +++ b/Kernel/Net/Socket.cpp @@ -241,6 +241,14 @@ ErrorOr Socket::getsockopt(OpenFileDescription&, int level, int option, Us size = sizeof(routing_disabled); return copy_to_user(value_size, &size); } + case SO_REUSEADDR: { + int reuse_address = 0; + if (size < sizeof(reuse_address)) + return EINVAL; + TRY(copy_to_user(static_ptr_cast(value), &reuse_address)); + size = sizeof(reuse_address); + return copy_to_user(value_size, &size); + } case SO_BROADCAST: { int broadcast_allowed = m_broadcast_allowed ? 1 : 0; if (size < sizeof(broadcast_allowed))