diff --git a/src/upnp.cpp b/src/upnp.cpp
index 39478fc89..c7531a501 100644
--- a/src/upnp.cpp
+++ b/src/upnp.cpp
@@ -608,6 +608,8 @@ void upnp::create_port_mapping(http_connection& c, rootdevice& d, int i)
char const* soap_action = "AddPortMapping";
+ std::string local_endpoint = print_address(c.socket().local_endpoint(ec).address());
+
char soap[2048];
error_code ec;
snprintf(soap, sizeof(soap), "\n"
@@ -620,14 +622,15 @@ void upnp::create_port_mapping(http_connection& c, rootdevice& d, int i)
"%u"
"%s"
"1"
- "%s"
+ "%s at %s:%d"
"%u"
""
, soap_action, d.service_namespace, d.mapping[i].external_port
, (d.mapping[i].protocol == udp ? "UDP" : "TCP")
, d.mapping[i].local_port
- , print_address(c.socket().local_endpoint(ec).address()).c_str()
- , m_user_agent.c_str(), d.lease_duration, soap_action);
+ , local_endpoint.c_str()
+ , m_user_agent.c_str(), local_endpoint.c_str(), d.mapping[i].local_port
+ , d.lease_duration, soap_action);
post(d, soap, soap_action, l);
}