upnpc.c: CheckPinholeWorking is optional

Error 602 should be returned if it is not implemented

see #658
This commit is contained in:
Thomas Bernard 2023-05-30 00:29:15 +02:00
parent cd703d4cd0
commit 5861f92425
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
2 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,9 @@
$Id: Changelog.txt,v 1.254 2022/10/21 21:13:12 nanard Exp $
$Id: Changelog.txt,v 1.255 2023/05/29 22:36:21 nanard Exp $
miniUPnP client Changelog.
2023/05/30:
CheckPinholeWorking is optional
VERSION 2.2.4 : released 2022/10/21
2022/02/20:

View File

@ -1,4 +1,4 @@
/* $Id: upnpc.c,v 1.131 2022/02/19 23:22:54 nanard Exp $ */
/* $Id: upnpc.c,v 1.133 2023/05/29 22:36:22 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas Bernard
* Copyright (c) 2005-2023 Thomas Bernard
@ -465,11 +465,20 @@ static void GetPinholeAndUpdate(struct UPNPUrls * urls, struct IGDdatas * data,
fprintf(stderr, "Wrong arguments\n");
return;
}
/* CheckPinholeWorking is an Optional Action, error 602 should be
* returned if it is not implemented */
r = UPNP_CheckPinholeWorking(urls->controlURL_6FC, data->IPv6FC.servicetype, uniqueID, &isWorking);
printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking)? "Yes":"No");
if(r!=UPNPCOMMAND_SUCCESS)
printf("CheckPinholeWorking() failed with code %d (%s)\n", r, strupnperror(r));
if(isWorking || r==709)
if(r==UPNPCOMMAND_SUCCESS)
printf("CheckPinholeWorking: Pinhole ID = %s / IsWorking = %s\n", uniqueID, (isWorking)? "Yes":"No");
else
printf("CheckPinholeWorking(%s) failed with code %d (%s)\n", uniqueID, r, strupnperror(r));
/* 702 FirewallDisabled Firewall is disabled and this action is disabled
* 703 InboundPinholeNotAllowed Creation of inbound pinholes by UPnP CPs
* are not allowed and this action is disabled
* 704 NoSuchEntry There is no pinhole with the specified UniqueID.
* 709 NoTrafficReceived No traffic corresponding to this pinhole has
* been received by the gateway. */
if(isWorking || r==709 || r==602)
{
r = UPNP_UpdatePinhole(urls->controlURL_6FC, data->IPv6FC.servicetype, uniqueID, lease_time);
printf("UpdatePinhole: Pinhole ID = %s with Lease Time: %s\n", uniqueID, lease_time);