mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
Kernel: Ignore interfaces without an IP address when routing packages
Let's not route packages through interfaces which don't have an address yet unless we're explicitly asked to (e.g. by DHCPClient).
This commit is contained in:
parent
eb1cecc03d
commit
7cd49ba2a2
1 changed files with 4 additions and 1 deletions
|
@ -152,7 +152,7 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
|
|||
RefPtr<NetworkAdapter> local_adapter = nullptr;
|
||||
RefPtr<NetworkAdapter> gateway_adapter = nullptr;
|
||||
|
||||
NetworkAdapter::for_each([source_addr, &target_addr, &local_adapter, &gateway_adapter, &matches](auto& adapter) {
|
||||
NetworkAdapter::for_each([source_addr, &target_addr, &local_adapter, &gateway_adapter, &matches, &through](auto& adapter) {
|
||||
auto adapter_addr = adapter.ipv4_address().to_u32();
|
||||
auto adapter_mask = adapter.ipv4_netmask().to_u32();
|
||||
|
||||
|
@ -161,6 +161,9 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
|
|||
return;
|
||||
}
|
||||
|
||||
if (!adapter.link_up() || (adapter_addr == 0 && !through))
|
||||
return;
|
||||
|
||||
if (source_addr != 0 && source_addr != adapter_addr)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue