diff --git a/mod_proxy.c b/mod_proxy.c index 683a518..ba540b5 100644 --- a/mod_proxy.c +++ b/mod_proxy.c @@ -2683,6 +2683,12 @@ MODRET proxy_eprt(cmd_rec *cmd, struct proxy_session *proxy_sess) { rfc1918_ipstr = pr_netaddr_get_ipstr(remote_addr); remote_addr = pr_netaddr_dup(session.pool, session.c->remote_addr); + + /* Make sure the remote port is set on our duplicated netaddr, too + * (Issue #158). + */ + pr_netaddr_set_port2(remote_addr, remote_port); + (void) pr_log_writefile(proxy_logfd, MOD_PROXY_VERSION, "client sent RFC1918 address '%s' in EPRT command, ignoring it and " "using '%s'", rfc1918_ipstr, pr_netaddr_get_ipstr(remote_addr)); @@ -3113,6 +3119,12 @@ MODRET proxy_port(cmd_rec *cmd, struct proxy_session *proxy_sess) { rfc1918_ipstr = pr_netaddr_get_ipstr(remote_addr); remote_addr = pr_netaddr_dup(session.pool, session.c->remote_addr); + + /* Make sure the remote port is set on our duplicated netaddr, too + * (Issue #158). + */ + pr_netaddr_set_port2(remote_addr, remote_port); + (void) pr_log_writefile(proxy_logfd, MOD_PROXY_VERSION, "client sent RFC1918 address '%s' in PORT command, ignoring it and " "using '%s'", rfc1918_ipstr, pr_netaddr_get_ipstr(remote_addr));