miniupnpd: improve AddAnyPortMapping()

try with next port when  -3 permission check failed

see #465
This commit is contained in:
Thomas Bernard 2020-05-30 10:29:24 +02:00
parent a30e3de4ba
commit a711165e6e
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $Id: upnpsoap.c,v 1.155 2019/04/08 13:31:46 nanard Exp $ */ /* $Id: upnpsoap.c,v 1.157 2020/05/30 08:28:22 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab /* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project * MiniUPnP project
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
@ -673,7 +673,8 @@ AddAnyPortMapping(struct upnphttp * h, const char * action, const char * ns)
* have some smart strategy to choose the port */ * have some smart strategy to choose the port */
for(;;) { for(;;) {
r = upnp_redirect(r_host, eport, int_ip, iport, protocol, desc, leaseduration); r = upnp_redirect(r_host, eport, int_ip, iport, protocol, desc, leaseduration);
if(r==-2 && eport < 65535) { if((r==-2 || r==-3) && eport < 65535) {
/* next port if -2 already redirected or -3 permission check failed */
eport++; eport++;
} else { } else {
break; break;