summaryrefslogtreecommitdiffhomepage
path: root/src/reqs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reqs.c')
-rw-r--r--src/reqs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 4d49583..e309fb2 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1368,7 +1368,7 @@ connect_to_upstream (struct conn_s *connptr, struct request_s *request)
connptr->server_fd =
opensock (cur_upstream->host, cur_upstream->port,
- connptr->server_ip_addr);
+ connptr->server_ip_addr, NULL);
if (connptr->server_fd < 0) {
log_message (LOG_WARNING,
@@ -1517,6 +1517,7 @@ void handle_connection (struct conn_s *connptr, union sockaddr_union* addr)
orderedmap hashofheaders = NULL;
char sock_ipaddr[IP_LENGTH];
+ char sock_ipaddr_mapped[IP_LENGTH];
char peer_ipaddr[IP_LENGTH];
getpeer_information (addr, peer_ipaddr, sizeof(peer_ipaddr));
@@ -1524,13 +1525,17 @@ void handle_connection (struct conn_s *connptr, union sockaddr_union* addr)
if (config->bindsame)
getsock_ip (fd, sock_ipaddr);
+ if (config->bind_ipv4mapped)
+ getmapped_ip (config->bind_ipv4mapped, sock_ipaddr, sock_ipaddr_mapped);
+
log_message (LOG_CONN, config->bindsame ?
"Connect (file descriptor %d): %s at [%s]" :
"Connect (file descriptor %d): %s",
fd, peer_ipaddr, sock_ipaddr);
if(!conn_init_contents (connptr, peer_ipaddr,
- config->bindsame ? sock_ipaddr : NULL)) {
+ config->bindsame ? sock_ipaddr : NULL,
+ config->bind_ipv4mapped ? sock_ipaddr_mapped : NULL)) {
close (fd);
return;
}
@@ -1670,7 +1675,8 @@ e401:
}
} else {
connptr->server_fd = opensock (request->host, request->port,
- connptr->server_ip_addr);
+ connptr->server_ip_addr,
+ connptr->server_ip_addr_mapped);
if (connptr->server_fd < 0) {
indicate_http_error (connptr, 500, "Unable to connect",
"detail",