miniupnpd/netfilter_nft: add debug messages about lease timestamps/duration

in order to debug issue #466
This commit is contained in:
Thomas Bernard 2020-05-30 10:09:22 +02:00
parent 6cd5ca6e9a
commit a30e3de4ba
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
2 changed files with 9 additions and 4 deletions

View File

@ -189,10 +189,13 @@ get_timestamp(unsigned short eport, int proto)
struct timestamp_entry * e;
e = timestamp_list;
while(e) {
if(e->eport == eport && e->protocol == (short)proto)
if(e->eport == eport && e->protocol == (short)proto) {
syslog(LOG_DEBUG, "timestamp entry found (%hu, %d, %u)", eport, proto, e->timestamp);
return e->timestamp;
}
e = e->next;
}
syslog(LOG_WARNING, "get_timestamp(%hu, %d) no entry found", eport, proto);
return 0;
}
@ -205,6 +208,7 @@ remove_timestamp_entry(unsigned short eport, int proto)
e = *p;
while(e) {
if(e->eport == eport && e->protocol == (short)proto) {
syslog(LOG_DEBUG, "timestamp entry removed (%hu, %d, %u)", eport, proto, e->timestamp);
/* remove the entry */
*p = e->next;
free(e);
@ -213,6 +217,7 @@ remove_timestamp_entry(unsigned short eport, int proto)
p = &(e->next);
e = *p;
}
syslog(LOG_WARNING, "remove_timestamp_entry(%hu, %d) no entry found", eport, proto);
}
static void
@ -227,6 +232,7 @@ add_timestamp_entry(unsigned short eport, int proto, unsigned timestamp)
tmp->eport = eport;
tmp->protocol = (short)proto;
timestamp_list = tmp;
syslog(LOG_DEBUG, "timestamp entry added (%hu, %d, %u)", eport, proto, timestamp);
}
else
{
@ -614,7 +620,6 @@ get_nat_redirect_rule(const char * nat_chain_name, const char * ifname,
UNUSED(nat_chain_name);
UNUSED(ifname);
UNUSED(iaddrlen);
UNUSED(timestamp);
UNUSED(packets);
UNUSED(bytes);
UNUSED(rhost);

View File

@ -775,10 +775,10 @@ GetSpecificPortMappingEntry(struct upnphttp * h, const char * action, const char
}
else
{
syslog(LOG_INFO, "%s: rhost='%s' %s %s found => %s:%u desc='%s'",
syslog(LOG_INFO, "%s: rhost='%s' %s %s found => %s:%u desc='%s' duration=%u",
action,
r_host ? r_host : "NULL", ext_port, protocol, int_ip,
(unsigned int)iport, desc);
(unsigned int)iport, desc, leaseduration);
bodylen = snprintf(body, sizeof(body), resp,
action, ns/*SERVICE_TYPE_WANIPC*/,
(unsigned int)iport, int_ip, desc, leaseduration,