summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2020-09-09 07:41:57 +0100
committerAndreas Kling <kling@serenityos.org>2020-09-27 01:02:11 +0200
commitec136db592394ee170b04eb99770a526fe8497a5 (patch)
tree42ea669bed7116a9ca01d1e0aaec217c280e2b99 /Kernel
parent93b9929391e2e797d8ae0ec4b6e30f32ce71f963 (diff)
downloadserenity-ec136db592394ee170b04eb99770a526fe8497a5.zip
Kernel: Return ENOPROTOOPT instead of asserting on unimplemented levels in getsockopt
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Net/Socket.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp
index 75e4383d89..0e197eeecf 100644
--- a/Kernel/Net/Socket.cpp
+++ b/Kernel/Net/Socket.cpp
@@ -156,7 +156,12 @@ KResult Socket::getsockopt(FileDescription&, int level, int option, Userspace<vo
if (!copy_from_user(&size, value_size.unsafe_userspace_ptr()))
return KResult(-EFAULT);
- ASSERT(level == SOL_SOCKET);
+ // FIXME: Add TCP_NODELAY, IPPROTO_TCP and IPPROTO_IP (used in OpenSSH)
+ if (level != SOL_SOCKET) {
+ // Not sure if this is the correct error code, but it's only temporary until other levels are implemented.
+ return KResult(-ENOPROTOOPT);
+ }
+
switch (option) {
case SO_SNDTIMEO:
if (size < sizeof(timeval))