miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

UPNP_STRICT mode
Goto page 1, 2  Next
 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Compilation/Installation
View previous topic :: View next topic  
Author Message
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Fri May 10, 2013 8:44 pm    Post subject: UPNP_STRICT mode Reply with quote

I'm looking at the conformance test for UPnP, and enabling UPNP_STRICT allows for MiniUPnPd to pass the advertising tests, but fails the add/delete/get generic port mapping. When UPNP_STRICT is disabled the opposite occurs.

Would it be better to have a different macro which forces remote hosts to be used, since sending a remote host string is not a requirement of UPnP...?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Sun May 12, 2013 9:33 pm    Post subject: Reply with quote

Could you post the detailed error messages about add/delete/get generic port mapping failing when UPNP_STRICT is enabled ???
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Mon May 13, 2013 4:38 pm    Post subject: Reply with quote

It fails with 402, Invalid args.

Code:
#ifdef UPNP_STRICT
   if(!ext_port || !protocol || !r_host)
#else
   if(!ext_port || !protocol)
#endif
   {
      ClearNameValueList(&data);
      SoapError(h, 402, "Invalid Args");
      return;
   }

You should not require the r_host when adding/removing since it is not required by specs, at least this is my understanding
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon May 13, 2013 5:03 pm    Post subject: Reply with quote

Quoting UDA (UPnP Device Architecture) 1.1 :
Quote:
Every “in” argument in the definition of the action in the service description MUST be included, in the same order as specified in the service description (SCPD) that is available
from the device.


and UPnP IGD WanIPConnection 1.0 spec :
Quote:
2.4.17.DeletePortMapping
This action deletes a previously instantiated port mapping. As each entry is deleted, the array is compacted, and the evented variable PortMappingNumberOfEntries is decremented.

2.4.17.1.Arguments
    Argument / Direction / relatedStateVariable
    NewRemoteHost / IN / RemoteHost
    NewExternalPort / IN / ExternalPort
    NewProtocol / IN / PortMappingProtocol


So NewRemoteHost argument MUST be included for DeletePortMapping.
Maybe it changed in UDA 2.0 ?
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Mon May 13, 2013 5:29 pm    Post subject: Reply with quote

The wildcard value needs to be supported, which is an empty string. WANIPConnection-v2-Service
Quote:
IGD 2 MUST support both wildcard and specific IP address values for RemoteHost (only the
wildcard value was REQUIRED in release 1.0)


I ran into this issue when using the UPnP Test Tool, since it sends add/remove/getGeneric port mappings with an empty string, but I believe that due to the check for r_host it fails the corresponding test case. Which doesn't make complete sense to me since even if it was an empty string r_host should be present
Back to top
View user's profile Send private message
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Tue May 14, 2013 5:02 pm    Post subject: Reply with quote

So I believe that the fix for this would be to remove the added check from UPNP_STRICT, since the r_host can be an empty string.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue May 14, 2013 5:16 pm    Post subject: Reply with quote

twear wrote:
So I believe that the fix for this would be to remove the added check from UPNP_STRICT, since the r_host can be an empty string.

As far as I remember this check was added to pass some compliance tests... I have to verify that r_host is not NULL when the <NewRemoteHost> element is there, even if empty.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Tue May 14, 2013 6:09 pm    Post subject: Reply with quote

is there a reason why it was added to getGeneric/delete port mapping but not add/addAny? I was also incorrect earlier, add does seem to work when an empty string is given for the remote host. However, the other 2 are still failing.

For getGenericPortMapping and Delete the conformance test is sending <NewRemoteHost></NewRemoteHost>, and UPnP returns <errorCode>402</errorCode>.
Back to top
View user's profile Send private message
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Tue May 14, 2013 6:18 pm    Post subject: Reply with quote

sorry, not getGeneric, getSpecific
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue May 14, 2013 7:24 pm    Post subject: Reply with quote

twear wrote:
is there a reason why it was added to getGeneric/delete port mapping but not add/addAny? I was also incorrect earlier, add does seem to work when an empty string is given for the remote host. However, the other 2 are still failing.

For getGenericPortMapping and Delete the conformance test is sending <NewRemoteHost></NewRemoteHost>, and UPnP returns <errorCode>402</errorCode>.

I guess the test suite (I remember it was CDRouter) was only checking GetSpecificPortMapping and DeletePortMapping Smile
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Tue May 14, 2013 8:35 pm    Post subject: Reply with quote

well I just tested the conformance tests after removing the r_host check, and everything passes fine.
Back to top
View user's profile Send private message
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Tue May 14, 2013 8:49 pm    Post subject: Reply with quote

I don't think this has anything to do with upnp_strict, but I'm also failing the addPortMapping case due to not sending back the PortMappingNumberOfEntries variable in the notification event. Is this expected?

Thanks for the help
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue May 14, 2013 9:20 pm    Post subject: Reply with quote

twear wrote:
well I just tested the conformance tests after removing the r_host check, and everything passes fine.

see how it works with this patch : https://github.com/miniupnp/miniupnp/commit/0f401fe2d5a25e928fba0f9a976fa5db10b54339
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue May 14, 2013 9:21 pm    Post subject: Reply with quote

twear wrote:
I don't think this has anything to do with upnp_strict, but I'm also failing the addPortMapping case due to not sending back the PortMappingNumberOfEntries variable in the notification event. Is this expected?

It is not expected, it has to be fixed too... tomorrow Smile
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
twear



Joined: 01 Nov 2012
Posts: 80

PostPosted: Tue May 14, 2013 9:57 pm    Post subject: Reply with quote

that patch worked perfectly, thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Compilation/Installation All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.