From 6429eca5e47aa1d438012a9886632a5cdbbec898 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Wed, 26 Mar 2025 08:10:56 +0100 Subject: [PATCH] udp-multicast: do not listen for incoming udp multicast packets if disabled (#6397) Currently the config flag only control if packets are sent, not received. As we discussed in VC this is not what was intended. --- src/main.cpp | 4 +++- src/mesh/wifi/WiFiAPClient.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 104982783..f65c3fcd1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -829,7 +829,9 @@ void setup() #ifdef ARCH_PORTDUINO // FIXME: portduino does not ever call onNetworkConnected so call it here because I don't know what happen if I call // onNetworkConnected there - udpThread->start(); + if (config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) { + udpThread->start(); + } #endif #endif service = new MeshService(); diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 92388d52a..4d0b74f7c 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -133,7 +133,7 @@ static void onNetworkConnected() } #if HAS_UDP_MULTICAST - if (udpThread) { + if (udpThread && config.network.enabled_protocols & meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST) { udpThread->start(); } #endif