mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-05 21:19:59 +00:00
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.
This commit is contained in:
parent
839e1faf49
commit
339758c9fc
1 changed files with 7 additions and 1 deletions
|
@ -26,6 +26,12 @@ void ProxySocket::HandleProxyPacket(const ProxyPacket& packet) {
|
|||
closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!broadcast && packet.broadcast) {
|
||||
LOG_INFO(Network, "Received broadcast packet, but not configured for broadcast mode");
|
||||
return;
|
||||
}
|
||||
|
||||
std::lock_guard guard(packets_mutex);
|
||||
received_packets.push(packet);
|
||||
}
|
||||
|
@ -203,7 +209,7 @@ std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, const std::vector<u8>& mess
|
|||
packet.local_endpoint = local_endpoint;
|
||||
packet.remote_endpoint = *addr;
|
||||
packet.protocol = protocol;
|
||||
packet.broadcast = broadcast;
|
||||
packet.broadcast = broadcast && packet.remote_endpoint.ip[3] == 255;
|
||||
|
||||
auto& ip = local_endpoint.ip;
|
||||
auto ipv4 = Network::GetHostIPv4Address();
|
||||
|
|
Loading…
Reference in a new issue