miniupnpd/natpmp.c: avoid hang when all external ports in use
reorganize a bit
This commit is contained in:
parent
c6a8879c87
commit
3c90f6a30d
|
@ -1,5 +1,8 @@
|
||||||
$Id: Changelog.txt,v 1.352 2014/02/24 18:41:23 nanard Exp $
|
$Id: Changelog.txt,v 1.352 2014/02/24 18:41:23 nanard Exp $
|
||||||
|
|
||||||
|
2014/02/28:
|
||||||
|
natpmp : avoid hang when all external ports in use
|
||||||
|
|
||||||
2014/02/24:
|
2014/02/24:
|
||||||
Defaulting to SSDP_RESPOND_SAME_VERSION
|
Defaulting to SSDP_RESPOND_SAME_VERSION
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,6 @@ void ProcessIncomingNATPMPPacket(int s, unsigned char *msg_buff, int len,
|
||||||
int proto;
|
int proto;
|
||||||
char iaddr_old[16];
|
char iaddr_old[16];
|
||||||
unsigned short iport_old;
|
unsigned short iport_old;
|
||||||
unsigned short eport_first;
|
|
||||||
unsigned int timestamp;
|
unsigned int timestamp;
|
||||||
|
|
||||||
iport = ntohs(*((uint16_t *)(req+4)));
|
iport = ntohs(*((uint16_t *)(req+4)));
|
||||||
|
@ -268,6 +267,8 @@ void ProcessIncomingNATPMPPacket(int s, unsigned char *msg_buff, int len,
|
||||||
|| !check_upnp_rule_against_permissions(upnppermlist, num_upnpperm, eport, senderaddr->sin_addr, iport)) {
|
|| !check_upnp_rule_against_permissions(upnppermlist, num_upnpperm, eport, senderaddr->sin_addr, iport)) {
|
||||||
resp[3] = 2; /* Not Authorized/Refused */
|
resp[3] = 2; /* Not Authorized/Refused */
|
||||||
} else {
|
} else {
|
||||||
|
unsigned short eport_first;
|
||||||
|
char desc[64];
|
||||||
eport_first = eport;
|
eport_first = eport;
|
||||||
do {
|
do {
|
||||||
r = get_redirect_rule(ext_if_name, eport, proto,
|
r = get_redirect_rule(ext_if_name, eport, proto,
|
||||||
|
@ -296,8 +297,7 @@ void ProcessIncomingNATPMPPacket(int s, unsigned char *msg_buff, int len,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ /* do the redirection */
|
/* do the redirection */
|
||||||
char desc[64];
|
|
||||||
#if 0
|
#if 0
|
||||||
timestamp = (unsigned)(time(NULL) - startup_time)
|
timestamp = (unsigned)(time(NULL) - startup_time)
|
||||||
+ lifetime;
|
+ lifetime;
|
||||||
|
@ -323,7 +323,6 @@ void ProcessIncomingNATPMPPacket(int s, unsigned char *msg_buff, int len,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
} while(r==0);
|
} while(r==0);
|
||||||
}
|
}
|
||||||
*((uint16_t *)(resp+8)) = htons(iport); /* private port */
|
*((uint16_t *)(resp+8)) = htons(iport); /* private port */
|
||||||
|
|
Loading…
Reference in New Issue