mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +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:
parent
8b2beb2ebe
commit
545f4b6cc1
7 changed files with 36 additions and 6 deletions
|
@ -49,6 +49,11 @@ static bool send(InterfaceDescriptor const& iface, DHCPv4Packet const& packet, C
|
|||
dbgln("ERROR: setsockopt(SO_BINDTODEVICE) :: {}", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
int allow_broadcast = 1;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &allow_broadcast, sizeof(int)) < 0) {
|
||||
dbgln("ERROR: setsockopt(SO_BROADCAST) :: {}", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
sockaddr_in dst;
|
||||
memset(&dst, 0, sizeof(dst));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue