diff options
| author | 2022-08-27 03:39:02 +0200 | |
|---|---|---|
| committer | 2022-08-27 03:39:02 +0200 | |
| commit | 339758c9fce9a211f85f62182d8fa0e1115c229b (patch) | |
| tree | 5c85a041ebfaeba1865cfe21752e54c590e1ce31 /src/core | |
| parent | yuzu: Display current game version in multiplayer room (diff) | |
| download | yuzu-339758c9fce9a211f85f62182d8fa0e1115c229b.tar.gz yuzu-339758c9fce9a211f85f62182d8fa0e1115c229b.tar.xz yuzu-339758c9fce9a211f85f62182d8fa0e1115c229b.zip | |
core/socket_proxy: Correct broadcast behavior
Broadcasts should only be sent when the broadcast IP is used.
They should also only be received when SO_BROADCAST is enabled.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/internal_network/socket_proxy.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/internal_network/socket_proxy.cpp b/src/core/internal_network/socket_proxy.cpp index 49d067f4c..0c746bd82 100644 --- a/src/core/internal_network/socket_proxy.cpp +++ b/src/core/internal_network/socket_proxy.cpp | |||
| @@ -26,6 +26,12 @@ void ProxySocket::HandleProxyPacket(const ProxyPacket& packet) { | |||
| 26 | closed) { | 26 | closed) { |
| 27 | return; | 27 | return; |
| 28 | } | 28 | } |
| 29 | |||
| 30 | if (!broadcast && packet.broadcast) { | ||
| 31 | LOG_INFO(Network, "Received broadcast packet, but not configured for broadcast mode"); | ||
| 32 | return; | ||
| 33 | } | ||
| 34 | |||
| 29 | std::lock_guard guard(packets_mutex); | 35 | std::lock_guard guard(packets_mutex); |
| 30 | received_packets.push(packet); | 36 | received_packets.push(packet); |
| 31 | } | 37 | } |
| @@ -203,7 +209,7 @@ std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, const std::vector<u8>& mess | |||
| 203 | packet.local_endpoint = local_endpoint; | 209 | packet.local_endpoint = local_endpoint; |
| 204 | packet.remote_endpoint = *addr; | 210 | packet.remote_endpoint = *addr; |
| 205 | packet.protocol = protocol; | 211 | packet.protocol = protocol; |
| 206 | packet.broadcast = broadcast; | 212 | packet.broadcast = broadcast && packet.remote_endpoint.ip[3] == 255; |
| 207 | 213 | ||
| 208 | auto& ip = local_endpoint.ip; | 214 | auto& ip = local_endpoint.ip; |
| 209 | auto ipv4 = Network::GetHostIPv4Address(); | 215 | auto ipv4 = Network::GetHostIPv4Address(); |