diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-11-06 23:25:56 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-11-07 00:00:23 +0100 |
commit | 8c3931988c501f8a78b10f60fa6538dd5a8a4296 (patch) | |
tree | 2e0d728dbb951ccaf2fc1e5a571116592083b984 /src/reqs.c | |
parent | adad565c03f3ffde6520646bc5d119ce1eadbadb (diff) |
WIP: BindIPv4Mapped
Diffstat (limited to 'src/reqs.c')
-rw-r--r-- | src/reqs.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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", |