From 47fb684261458987091f36fedc8cba6ea5b433b6 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Tue, 4 Feb 2025 12:18:32 +0000 Subject: [PATCH 1/3] Catch and process broadcast addresses --- src/udp_collector.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/udp_collector.cpp b/src/udp_collector.cpp index 8e0366e7a..b4e0bdb68 100644 --- a/src/udp_collector.cpp +++ b/src/udp_collector.cpp @@ -390,6 +390,14 @@ void UDPCollector::process_one(const SockAddr &dest, const uint8_t *buf, size_t for(auto L : listeners) { if(L->searchCB && (L->dest.addr.isAny() || L->dest.addr==dest)) { (L->searchCB)(*this); + } else if(L->searchCB && !(L->dest.addr.isAny())) { + for(auto B : sock.broadcasts(&(L->dest.addr))) { + if(B.compare(dest, false) == 0 && L->dest.addr.port() == dest.port()) { + log_debug_printf(logio, "Processing broadcast %s on %s\n", + dest.tostring().c_str(), L->dest.addr.tostring().c_str()); + (L->searchCB)(*this); + } + } } } From bb93b3095d096c7971f14723c86ab03c66e6c92d Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Tue, 4 Feb 2025 12:44:23 +0000 Subject: [PATCH 2/3] Reformat --- src/udp_collector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/udp_collector.cpp b/src/udp_collector.cpp index b4e0bdb68..689224cfc 100644 --- a/src/udp_collector.cpp +++ b/src/udp_collector.cpp @@ -392,7 +392,7 @@ void UDPCollector::process_one(const SockAddr &dest, const uint8_t *buf, size_t (L->searchCB)(*this); } else if(L->searchCB && !(L->dest.addr.isAny())) { for(auto B : sock.broadcasts(&(L->dest.addr))) { - if(B.compare(dest, false) == 0 && L->dest.addr.port() == dest.port()) { + if(!B.compare(dest, false) && L->dest.addr.port() == dest.port()) { log_debug_printf(logio, "Processing broadcast %s on %s\n", dest.tostring().c_str(), L->dest.addr.tostring().c_str()); (L->searchCB)(*this); From beca6565f95a5c7b9390c35b88d41755acdadde2 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Tue, 4 Feb 2025 12:46:19 +0000 Subject: [PATCH 3/3] format --- src/udp_collector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/udp_collector.cpp b/src/udp_collector.cpp index 689224cfc..b0498df13 100644 --- a/src/udp_collector.cpp +++ b/src/udp_collector.cpp @@ -392,7 +392,7 @@ void UDPCollector::process_one(const SockAddr &dest, const uint8_t *buf, size_t (L->searchCB)(*this); } else if(L->searchCB && !(L->dest.addr.isAny())) { for(auto B : sock.broadcasts(&(L->dest.addr))) { - if(!B.compare(dest, false) && L->dest.addr.port() == dest.port()) { + if(!(B.compare(dest, false)) && (L->dest.addr.port() == dest.port())) { log_debug_printf(logio, "Processing broadcast %s on %s\n", dest.tostring().c_str(), L->dest.addr.tostring().c_str()); (L->searchCB)(*this);