Disallow sending UDP Message Protocol traffic to broadcast address

This commit is contained in:
Bill Somerville 2020-11-03 23:08:12 +00:00
parent a6a176bf6e
commit 698bd23a9c
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F

View File

@ -148,6 +148,13 @@ void MessageClient::impl::start ()
return; return;
} }
if (is_broadcast_address (server_))
{
Q_EMIT self_->error ("IPv4 broadcast not supported, please specify the loop-back address, a server host address, or multicast group address");
pending_messages_.clear (); // discard
return;
}
if (blocked_addresses_.end () != std::find (blocked_addresses_.begin (), blocked_addresses_.end (), server_)) if (blocked_addresses_.end () != std::find (blocked_addresses_.begin (), blocked_addresses_.end (), server_))
{ {
Q_EMIT self_->error ("UDP server blocked, please try another"); Q_EMIT self_->error ("UDP server blocked, please try another");
@ -181,13 +188,6 @@ void MessageClient::impl::start ()
} }
} }
if (server_.isBroadcast ())
{
// only allow broadcast on the loopback interface to avoid
// flooding the local subnet which may be large with some ISPs
//interface_ip.setAddress ("127.0.0.1");
}
if (localAddress () != interface_ip) if (localAddress () != interface_ip)
{ {
if (UnconnectedState != state () || state ()) if (UnconnectedState != state () || state ())