diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-12 17:27:07 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-12 17:27:07 +0100 |
commit | a7d5e9781af3735a56d3e9665fd5a1026258c932 (patch) | |
tree | 93774500344e556110ee4bd2f71e24375cab7ba5 /Kernel/NetworkTask.cpp | |
parent | a017a7744279a29ab490c0aa7d2a81deb0997ae4 (diff) | |
download | serenity-a7d5e9781af3735a56d3e9665fd5a1026258c932.zip |
Kernel+LibC+Userland: Yet more networking bringup hacking.
All ICMP sockets now receive all ICMP packets. All this buffering is gonna
need some limits and such.
Diffstat (limited to 'Kernel/NetworkTask.cpp')
-rw-r--r-- | Kernel/NetworkTask.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Kernel/NetworkTask.cpp b/Kernel/NetworkTask.cpp index b8984d0a94..b579bd8dfe 100644 --- a/Kernel/NetworkTask.cpp +++ b/Kernel/NetworkTask.cpp @@ -3,6 +3,7 @@ #include <Kernel/ARP.h> #include <Kernel/ICMP.h> #include <Kernel/IPv4.h> +#include <Kernel/IPv4Socket.h> #include <Kernel/Process.h> #include <Kernel/EtherType.h> #include <AK/Lock.h> @@ -165,6 +166,16 @@ void handle_icmp(const EthernetFrameHeader& eth, int frame_size) ); #endif + { + LOCKER(IPv4Socket::all_sockets().lock()); + for (RetainPtr<IPv4Socket> socket : IPv4Socket::all_sockets().resource()) { + LOCKER(socket->lock()); + if (socket->protocol() != (unsigned)IPv4Protocol::ICMP) + continue; + socket->did_receive(ByteBuffer::copy((const byte*)&ipv4_packet, sizeof(IPv4Packet) + ipv4_packet.payload_size())); + } + } + auto* adapter = NetworkAdapter::from_ipv4_address(ipv4_packet.destination()); if (!adapter) return; |