diff options
Diffstat (limited to 'Kernel/Net/Socket.cpp')
-rw-r--r-- | Kernel/Net/Socket.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp index da99bfd724..b3187c585e 100644 --- a/Kernel/Net/Socket.cpp +++ b/Kernel/Net/Socket.cpp @@ -123,6 +123,14 @@ ErrorOr<void> Socket::setsockopt(int level, int option, Userspace<const void*> u return ENOTSUP; } return {}; + case SO_DONTROUTE: { + int routing_disabled; + if (user_value_size != sizeof(routing_disabled)) + return EINVAL; + TRY(copy_from_user(&routing_disabled, static_ptr_cast<const int*>(user_value))); + m_routing_disabled = routing_disabled != 0; + return {}; + } default: dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option); return ENOPROTOOPT; @@ -216,6 +224,14 @@ ErrorOr<void> Socket::getsockopt(OpenFileDescription&, int level, int option, Us size = sizeof(accepting_connections); return copy_to_user(value_size, &size); } + case SO_DONTROUTE: { + int routing_disabled = m_routing_disabled ? 1 : 0; + if (size < sizeof(routing_disabled)) + return EINVAL; + TRY(copy_to_user(static_ptr_cast<int*>(value), &routing_disabled)); + size = sizeof(routing_disabled); + return copy_to_user(value_size, &size); + } default: dbgln("setsockopt({}) at SOL_SOCKET not implemented.", option); return ENOPROTOOPT; |