Prevent sending probe packets to invalid addresses

This commit is contained in:
Jeremy Lakeman 2013-02-15 16:13:08 +10:30
parent eeb7fb7f9b
commit d80b5a0c8d

View File

@ -254,6 +254,11 @@ int overlay_send_probe(struct subscriber *peer, struct sockaddr_in addr, overlay
if (interface->state!=INTERFACE_STATE_UP)
return WHY("I can't send a probe if the interface is down.");
if (addr.sin_addr.s_addr==0)
return WHY("I can't send a probe to address 0.0.0.0");
if (addr.sin_port==0)
return WHY("I can't send a probe to port 0");
// never send unicast probes over a stream interface
if (interface->socket_type==SOCK_STREAM)
return 0;