[MINOR] use s->frt_addr as the server's address in transparent proxy

There's no point trying to check original dest addr with only one
method when doing transparent proxy as in full transparent mode,
the real destination address is required. Let's copy the one from
the frontend.
This commit is contained in:
Willy Tarreau 2008-01-19 13:46:35 +01:00
parent d6f087ea1c
commit bd41428fee

View File

@ -1015,12 +1015,13 @@ int assign_server_address(struct session *s)
} }
else if (s->fe->options & PR_O_TRANSP) { else if (s->fe->options & PR_O_TRANSP) {
/* in transparent mode, use the original dest addr if no dispatch specified */ /* in transparent mode, use the original dest addr if no dispatch specified */
socklen_t salen = sizeof(s->srv_addr); if (!(s->flags & SN_FRT_ADDR_SET))
get_frt_addr(s);
if (get_original_dst(s->cli_fd, &s->srv_addr, &salen) == -1) { memcpy(&s->srv_addr, &s->frt_addr, MIN(sizeof(s->srv_addr), sizeof(s->frt_addr)));
qfprintf(stderr, "Cannot get original server address.\n"); /* when we support IPv6 on the backend, we may add other tests */
return SRV_STATUS_INTERNAL; //qfprintf(stderr, "Cannot get original server address.\n");
} //return SRV_STATUS_INTERNAL;
} }
else if (s->be->options & PR_O_HTTP_PROXY) { else if (s->be->options & PR_O_HTTP_PROXY) {
/* If HTTP PROXY option is set, then server is already assigned /* If HTTP PROXY option is set, then server is already assigned