1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:28:11 +00:00

Kernel: Properly support the SO_BROADCAST socket option

POSIX requires that broadcast sends will only be allowed if the
SO_BROADCAST socket option was set on the socket.
Also, broadcast sends to protocols that do not support broadcast (like
TCP), should always fail.
This commit is contained in:
Idan Horowitz 2023-12-24 19:01:09 +02:00 committed by Andreas Kling
parent 8b2beb2ebe
commit 545f4b6cc1
7 changed files with 36 additions and 6 deletions

View file

@ -64,7 +64,12 @@ enum class AllowUsingGateway {
No,
};
RoutingDecision route_to(IPv4Address const& target, IPv4Address const& source, RefPtr<NetworkAdapter> const through = nullptr, AllowUsingGateway = AllowUsingGateway::Yes);
enum class AllowBroadcast {
Yes,
No,
};
RoutingDecision route_to(IPv4Address const& target, IPv4Address const& source, RefPtr<NetworkAdapter> const through = nullptr, AllowBroadcast = AllowBroadcast::No, AllowUsingGateway = AllowUsingGateway::Yes);
SpinlockProtected<HashMap<IPv4Address, MACAddress>, LockRank::None>& arp_table();
SpinlockProtected<Route::RouteList, LockRank::None>& routing_table();