improve SOCKS5 error alerts by including the interface address in no-route-to-host errors

This commit is contained in:
arvidn 2020-01-19 19:39:35 +01:00 committed by Arvid Norberg
parent f5ebd4e354
commit a40ae61f15
1 changed files with 3 additions and 2 deletions

View File

@ -527,7 +527,8 @@ void socks5::on_name_lookup(error_code const& e, tcp::resolver::iterator i)
if (e) if (e)
{ {
if (m_alerts.should_post<socks5_alert>()) if (m_alerts.should_post<socks5_alert>())
m_alerts.emplace_alert<socks5_alert>(m_proxy_addr, operation_t::hostname_lookup, e); m_alerts.emplace_alert<socks5_alert>(m_listen_socket.get_local_endpoint()
, operation_t::hostname_lookup, e);
return; return;
} }
@ -540,7 +541,7 @@ void socks5::on_name_lookup(error_code const& e, tcp::resolver::iterator i)
if (i == tcp::resolver::iterator{}) if (i == tcp::resolver::iterator{})
{ {
if (m_alerts.should_post<socks5_alert>()) if (m_alerts.should_post<socks5_alert>())
m_alerts.emplace_alert<socks5_alert>(tcp::endpoint() m_alerts.emplace_alert<socks5_alert>(m_listen_socket.get_local_endpoint()
, operation_t::hostname_lookup , operation_t::hostname_lookup
, error_code(boost::system::errc::host_unreachable, generic_category())); , error_code(boost::system::errc::host_unreachable, generic_category()));
return; return;