Merge pull request #57 from razzfazz/natpmp_avoid_port_zero

miniupnpd/natpmp.c: skip port zero when finding free eport
This commit is contained in:
Thomas BERNARD 2014-03-08 01:03:43 +01:00
commit 0ff8e67c26
1 changed files with 2 additions and 0 deletions

View File

@ -281,6 +281,7 @@ void ProcessIncomingNATPMPPacket(int s, unsigned char *msg_buff, int len,
while(resp[3] == 0) {
if(!check_upnp_rule_against_permissions(upnppermlist, num_upnpperm, eport, senderaddr->sin_addr, iport)) {
eport++;
if(eport == 0) eport++; /* skip port zero */
if(eport == eport_first) { /* no external port available */
syslog(LOG_ERR, "Failed to find available eport for NAT-PMP %hu %s->%s:%hu",
eport, (proto==IPPROTO_TCP)?"tcp":"udp", senderaddrstr, iport);
@ -305,6 +306,7 @@ void ProcessIncomingNATPMPPacket(int s, unsigned char *msg_buff, int len,
}
} else {
eport++;
if(eport == 0) eport++; /* skip port zero */
if(eport == eport_first) { /* no external port available */
syslog(LOG_ERR, "Failed to find available eport for NAT-PMP %hu %s->%s:%hu",
eport, (proto==IPPROTO_TCP)?"tcp":"udp", senderaddrstr, iport);