fix error message for IPV6. 2020

This commit is contained in:
Thomas Bernard 2020-11-05 21:59:25 +01:00
parent c77845f489
commit 30c27967ae
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
2 changed files with 30 additions and 6 deletions

View File

@ -3,7 +3,7 @@
* Project : miniupnp
* Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* Author : Thomas Bernard
* Copyright (c) 2005-2019 Thomas Bernard
* Copyright (c) 2005-2020 Thomas Bernard
* This software is subject to the conditions detailed in the
* LICENCE file included in this distribution.
* */
@ -949,7 +949,19 @@ Process_upnphttp(struct upnphttp * h)
}
else if(n==0)
{
syslog(LOG_WARNING, "HTTP Connection from %s closed unexpectedly", inet_ntoa(h->clientaddr));
#ifdef ENABLE_IPV6
if (h->ipv6)
{
char clientaddr_str[INET6_ADDRSTRLEN];
if(inet_ntop(AF_INET6, &(h->clientaddr_v6), clientaddr_str, INET6_ADDRSTRLEN) == NULL)
strncpy(clientaddr_str, "*inet_ntop error*", sizeof(clientaddr_str));
syslog(LOG_WARNING, "HTTP Connection from %s closed unexpectedly", clientaddr_str);
}
else
#endif
{
syslog(LOG_WARNING, "HTTP Connection from %s closed unexpectedly", inet_ntoa(h->clientaddr));
}
h->state = EToDelete;
}
else
@ -1019,7 +1031,19 @@ Process_upnphttp(struct upnphttp * h)
}
else if(n==0)
{
syslog(LOG_WARNING, "HTTP Connection from %s closed unexpectedly", inet_ntoa(h->clientaddr));
#ifdef ENABLE_IPV6
if (h->ipv6)
{
char clientaddr_str[INET6_ADDRSTRLEN];
if(inet_ntop(AF_INET6, &(h->clientaddr_v6), clientaddr_str, INET6_ADDRSTRLEN) == NULL)
strncpy(clientaddr_str, "*inet_ntop error*", sizeof(clientaddr_str));
syslog(LOG_WARNING, "HTTP Connection from %s closed unexpectedly", clientaddr_str);
}
else
#endif
{
syslog(LOG_WARNING, "HTTP Connection from %s closed unexpectedly", inet_ntoa(h->clientaddr));
}
h->state = EToDelete;
}
else

View File

@ -1,8 +1,8 @@
/* $Id: upnphttp.h,v 1.42 2015/12/16 10:21:49 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab */
/* MiniUPnP project
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2015 Thomas Bernard
* (c) 2006-2020 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */