AddPortMapping return error 729 - ConflictWithOtherMechanisms if IGD v2 is enabled

This commit is contained in:
Thomas Bernard 2016-02-12 14:54:13 +01:00
parent dd9bf47c68
commit cc35c1d450
3 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,7 @@
$Id: Changelog.txt,v 1.421 2016/02/12 12:34:37 nanard Exp $
2016/02/12:
return error 729 - ConflictWithOtherMechanisms if IGD v2 is enabled.
add iptc_init() check in iptcrdr.c/init_redirect()
2016/02/11:

View File

@ -1,7 +1,7 @@
/* $Id: upnpredirect.c,v 1.85 2014/12/09 09:17:54 nanard Exp $ */
/* $Id: upnpredirect.c,v 1.90 2016/02/12 12:59:41 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2014 Thomas Bernard
* (c) 2006-2016 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -254,6 +254,7 @@ int reload_from_lease_file()
* -1 failed to redirect
* -2 already redirected
* -3 permission check failed
* -4 already redirected (other mechanism)
*/
int
upnp_redirect(const char * rhost, unsigned short eport,
@ -299,7 +300,7 @@ upnp_redirect(const char * rhost, unsigned short eport,
} else if (port_in_use(ext_if_name, eport, proto, iaddr, iport) > 0) {
syslog(LOG_INFO, "port %hu protocol %s already in use",
eport, protocol);
return -2;
return -4;
#endif /* CHECK_PORTINUSE */
} else {
timestamp = (leaseduration > 0) ? time(NULL) + leaseduration : 0;

View File

@ -1,7 +1,7 @@
/* $Id: upnpsoap.c,v 1.142 2015/12/15 11:12:37 nanard Exp $ */
/* $Id: upnpsoap.c,v 1.144 2016/02/12 12:35:03 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2015 Thomas Bernard
* (c) 2006-2016 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -474,7 +474,7 @@ AddPortMapping(struct upnphttp * h, const char * action, const char * ns)
ExternalPort must be a wildcard and cannot be a specific port
value (deprecated in IGD v2)
* 728 - NoPortMapsAvailable
There are not enough free prots available to complete the mapping
There are not enough free ports available to complete the mapping
(added in IGD v2)
* 729 - ConflictWithOtherMechanisms (added in IGD v2) */
switch(r)
@ -484,6 +484,11 @@ AddPortMapping(struct upnphttp * h, const char * action, const char * ns)
action, ns/*SERVICE_TYPE_WANIPC*/);
BuildSendAndCloseSoapResp(h, body, bodylen);
break;
case -4:
#ifdef IGD_V2
SoapError(h, 729, "ConflictWithOtherMechanisms");
break;
#endif /* IGD_V2 */
case -2: /* already redirected */
case -3: /* not permitted */
SoapError(h, 718, "ConflictInMappingEntry");