try to reuse interface binding socket addresses instead of failing.

This commit is contained in:
gardners 2012-05-17 13:09:45 +09:30
parent 2434d51bee
commit fa8825a3ec

View File

@ -187,6 +187,13 @@ int overlay_interface_init_socket(int interface,struct sockaddr_in src_addr,stru
} else
WHYF("interface #%d fd=%d",interface,I(fd));
int reuseP=1;
if(setsockopt( I(fd), SOL_SOCKET, SO_REUSEADDR, &reuseP, sizeof(reuseP)) < 0)
{
WHY("Could not mark socket to reuse addresses. Not necessarily a problem (yet)");
WHY_perror("setsockopt");
}
int broadcastP=1;
if(setsockopt(I(fd), SOL_SOCKET, SO_BROADCAST, &broadcastP, sizeof(broadcastP)) < 0) {
WHY("Could not enable broadcast reception for socket. This is really bad.");