We only need to spoof the address. Set port so OS can randomly assign
a new one for use that will not clash with existing spoofs.
Also fix teh debug message on ResetFD failure to bind so we can see which
FD and which address:port were attempted when it failed.
/* Trust the user configured properly. If not no harm done.
* We will simply attempt a bind outgoing on our own IP.
- * Maybe a port clash which will show them the problem.
*/
- return (fd_table[fd].flags.transparent ? 0 : -1);
-#else
- return -1;
+ if(fd_table[fd].flags.transparent) {
+ dst.SetPort(0); // allow random outgoing port to prevent address clashes
+ return 0;
+ }
#endif
+ return -1;
}
int
F->local_addr.GetAddrInfo(AI);
if (commBind(fd, *AI) != COMM_OK) {
- debugs(5, 0, HERE << "bind: " << xstrerror());
+ debugs(5, DBG_CRITICAL, "WARNING: Reset of FD " << fd << " for " << F->local_addr << " failed to bind: " << xstrerror());
F->local_addr.FreeAddrInfo(AI);
return 0;
}