From 1fc9a7062c7e66bd0fd7a817a84bcbe2bb1e4940 Mon Sep 17 00:00:00 2001 From: retu2libc Date: Sun, 25 Feb 2024 16:13:41 -0500 Subject: [PATCH] Drop ethernet frames not destined for us or broadcast --- src/Home/Net/Utilities/NetHandler.ZC | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Home/Net/Utilities/NetHandler.ZC b/src/Home/Net/Utilities/NetHandler.ZC index fad866ad..f7dc2061 100755 --- a/src/Home/Net/Utilities/NetHandler.ZC +++ b/src/Home/Net/Utilities/NetHandler.ZC @@ -37,6 +37,16 @@ U0 NetQueueEntryHandle(CNetQueueEntry *entry) EthernetFrameParse(ðernet_frame, entry->frame, entry->packet_length); + U8 *mac = EthernetMACGet(); + Bool is_our_mac = !MemCompare(mac, ethernet_frame.destination_address, MAC_ADDRESS_LENGTH); // check the RX packet MAC against local MAC + Bool is_broadcast = !MemCompare(ethernet_globals.ethernet_broadcast, ethernet_frame.destination_address, MAC_ADDRESS_LENGTH); // check the RX packet MAC against broadcast MAC + + if (!is_our_mac && !is_broadcast) + { + NetLog("HANDLE NETQUEUE ENTRY: Not for us, discarding."); + return; + } + switch (ethernet_frame.ethertype) { case ETHERTYPE_ARP: