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

View File

@ -775,10 +775,10 @@ GetSpecificPortMappingEntry(struct upnphttp * h, const char * action, const char
} }
else 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, action,
r_host ? r_host : "NULL", ext_port, protocol, int_ip, 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, bodylen = snprintf(body, sizeof(body), resp,
action, ns/*SERVICE_TYPE_WANIPC*/, action, ns/*SERVICE_TYPE_WANIPC*/,
(unsigned int)iport, int_ip, desc, leaseduration, (unsigned int)iport, int_ip, desc, leaseduration,