From e468759df4ca39fe658d943f58abb2b48946a121 Mon Sep 17 00:00:00 2001 From: Weixuan Xiao Date: Tue, 19 Jul 2022 10:14:35 +0000 Subject: [PATCH] Send broadcast on each LAN interfaces on FreeBSD On FreeBSD 12 or later, a new routing strategy is introduced, which prevents broadcast using 255.255.255.255. Thus, we need to explicitly send the broadcast to each network interfaces. Here the commit can simply reuse the code for Windows. Ref: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252596 --- core/backends/lan/lanlinkprovider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp index 18785a87a..6eee510f6 100644 --- a/core/backends/lan/lanlinkprovider.cpp +++ b/core/backends/lan/lanlinkprovider.cpp @@ -173,8 +173,8 @@ void LanLinkProvider::broadcastToNetwork() } #endif -#ifdef Q_OS_WIN - //On Windows we need to broadcast from every local IP address to reach all networks +#if defined(Q_OS_WIN) || defined(Q_OS_FREEBSD) + //On Windows and FreeBSD we need to broadcast from every local IP address to reach all networks QUdpSocket sendSocket; sendSocket.setProxy(QNetworkProxy::NoProxy); for (const QNetworkInterface& iface : QNetworkInterface::allInterfaces()) {