connection->remote = ia->in_addrs[ia->cur];
connection->remote.SetPort(s.cfg().port);
getOutgoingAddress(NULL, connection);
- if (connection->remote.IsIPv4() && !connection->local.SetIPv4()) {
- // This should never happen. getOutgoing should match by family or skip.
- Must(connection->local.IsAnyAddr());
- return;
- }
// TODO: service bypass status may differ from that of a transaction
typedef CommCbMemFunT<Adaptation::Icap::Xaction, CommConnectCbParams> ConnectDialer;
void
getOutgoingAddress(HttpRequest * request, Comm::ConnectionPointer conn)
{
- /* skip if an outgoing address is already set. */
+ // skip if an outgoing address is already set.
if (!conn->local.IsAnyAddr()) return;
+ // ensure that at minimum the wildcard local matches remote protocol
+ if (conn->remote.IsIPv4())
+ conn->local.SetIPv4();
+
// maybe use TPROXY client address
if (request && request->flags.spoof_client_ip) {
if (!conn->getPeer() || !conn->getPeer()->options.no_tproxy) {
// check for a configured outgoing address for this destination...
getOutgoingAddress(psstate->request, p);
- if (p->remote.IsIPv4() && !p->local.SetIPv4()) {
- // This should never happen. getOutgoing should match by family or skip.
- assert(p->local.IsAnyAddr());
- continue;
- } else {
- psstate->paths->push_back(p);
- }
+ psstate->paths->push_back(p);
}
} else {
debugs(44, 3, HERE << "Unknown host: " << fs->_peer ? fs->_peer->host : psstate->request->GetHost());