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

Kernel: Add the SO_BINDTODEVICE socket option

This patch adds a way for a socket to ask to be routed through a
specific interface.
Currently, this option only applies to sending, however, it should also
apply to receiving...somehow :^)
This commit is contained in:
AnotherTest 2020-04-05 01:16:45 +04:30 committed by Andreas Kling
parent 7d0bf9b5a9
commit 77191d82dc
10 changed files with 186 additions and 13 deletions

View file

@ -92,7 +92,7 @@ int UDPSocket::protocol_receive(const KBuffer& packet_buffer, void* buffer, size
int UDPSocket::protocol_send(const void* data, size_t data_length)
{
auto routing_decision = route_to(peer_address(), local_address());
auto routing_decision = route_to(peer_address(), local_address(), bound_interface());
if (routing_decision.is_zero())
return -EHOSTUNREACH;
auto buffer = ByteBuffer::create_zeroed(sizeof(UDPPacket) + data_length);