Kernel: Stub out getsockopt for the SO_REUSEADDR option

We currently discard setsockopt for SO_REUSEADDR, so to ensure
consistency, support getsockopt as well.
This commit is contained in:
Idan Horowitz 2023-12-24 19:04:49 +02:00 committed by Andreas Kling
parent 545f4b6cc1
commit dca5c71e53

View file

@ -241,6 +241,14 @@ ErrorOr<void> 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<int*>(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))