|
@@ -201,12 +201,13 @@ void handle_ipv4(EthernetFrameHeader const& eth, size_t frame_size, Time const&
|
|
|
dbgln_if(IPV4_DEBUG, "handle_ipv4: source={}, destination={}", packet.source(), packet.destination());
|
|
|
|
|
|
NetworkingManagement::the().for_each([&](auto& adapter) {
|
|
|
- if (adapter.link_up()) {
|
|
|
- auto my_net = adapter.ipv4_address().to_u32() & adapter.ipv4_netmask().to_u32();
|
|
|
- auto their_net = packet.source().to_u32() & adapter.ipv4_netmask().to_u32();
|
|
|
- if (my_net == their_net)
|
|
|
- update_arp_table(packet.source(), eth.source(), UpdateTable::Set);
|
|
|
- }
|
|
|
+ if (adapter.ipv4_address().is_zero() || !adapter.link_up())
|
|
|
+ return;
|
|
|
+
|
|
|
+ auto my_net = adapter.ipv4_address().to_u32() & adapter.ipv4_netmask().to_u32();
|
|
|
+ auto their_net = packet.source().to_u32() & adapter.ipv4_netmask().to_u32();
|
|
|
+ if (my_net == their_net)
|
|
|
+ update_arp_table(packet.source(), eth.source(), UpdateTable::Set);
|
|
|
});
|
|
|
|
|
|
switch ((IPv4Protocol)packet.protocol()) {
|