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