miniupnpd/upnputils.c: improve log in get_lan_for_peer()

This commit is contained in:
Thomas Bernard 2014-02-06 10:55:57 +01:00
parent 18f02dccb3
commit bc67a7133b
1 changed files with 10 additions and 5 deletions

View File

@ -93,6 +93,7 @@ struct lan_addr_s *
get_lan_for_peer(const struct sockaddr * peer) get_lan_for_peer(const struct sockaddr * peer)
{ {
struct lan_addr_s * lan_addr = NULL; struct lan_addr_s * lan_addr = NULL;
char dbg_str[64];
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
if(peer->sa_family == AF_INET6) if(peer->sa_family == AF_INET6)
@ -153,11 +154,15 @@ get_lan_for_peer(const struct sockaddr * peer)
} }
#endif #endif
if(lan_addr) sockaddr_to_string(peer, dbg_str, sizeof(dbg_str));
syslog(LOG_DEBUG, "%s: found in LAN %s %s", if(lan_addr) {
"get_lan_for_peer()", lan_addr->ifname, lan_addr->str); syslog(LOG_DEBUG, "%s: %s found in LAN %s %s",
else "get_lan_for_peer()", dbg_str,
syslog(LOG_DEBUG, "%s: not found !", "get_lan_for_peer()"); lan_addr->ifname, lan_addr->str);
} else {
syslog(LOG_DEBUG, "%s: %s not found !", "get_lan_for_peer()",
dbg_str);
}
return lan_addr; return lan_addr;
} }