1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 21:32:07 +00:00

Kernel: Treat 0.0.0.0 as a loopback address

This matches what other operating systems like Linux do:

$ ip route get 0.0.0.0
local 0.0.0.0 dev lo src 127.0.0.1 uid 1000
    cache <local>

$ ssh 0.0.0.0
gunnar@0.0.0.0's password:

$ ss -na | grep :22 | grep ESTAB
tcp   ESTAB      0      0   127.0.0.1:43118   127.0.0.1:22
tcp   ESTAB      0      0   127.0.0.1:22      127.0.0.1:43118
This commit is contained in:
Gunnar Beutner 2021-05-12 12:14:03 +02:00 committed by Andreas Kling
parent af59f64bc0
commit 532db9f768
3 changed files with 6 additions and 0 deletions

View file

@ -141,6 +141,8 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
return { adapter, mac };
};
if (target[0] == 0 && target[1] == 0 && target[2] == 0 && target[3] == 0)
return if_matches(LoopbackAdapter::the(), LoopbackAdapter::the().mac_address());
if (target[0] == 127)
return if_matches(LoopbackAdapter::the(), LoopbackAdapter::the().mac_address());