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 

Netopia Smartmodem 3347-02
Goto page 1, 2  Next
 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs
View previous topic :: View next topic  
Author Message
Rick



Joined: 10 Dec 2008
Posts: 10

PostPosted: Wed Dec 10, 2008 10:02 pm    Post subject: Netopia Smartmodem 3347-02 Reply with quote

This is a bit strange, because utorrent's upnp plug-in manages to get its port forwarded, but any attempt with miniupnpc results in
"Found a (not connected?) IGD "
...
GetExternalIPAddress() returned 401
AddPortMapping(22, 22, 192.168.1.34) failed with code 401
GetSpecificPortMappingEntry() failed with code 401

and then it all goes to pieces.

Which I could understand...but, well, utorrent magically does the trick.
Oh, and once upon a time, a single time only, win XP discovered the UPNP device, but never has it reappeared since....
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Wed Dec 10, 2008 10:08 pm    Post subject: Reply with quote

to understand what happens, you can use software such as wireshark (ethereal, tshark, tcpdump) to capture the communication between utorrent and the router...
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Rick



Joined: 10 Dec 2008
Posts: 10

PostPosted: Wed Dec 10, 2008 10:25 pm    Post subject: Reply with quote

Yeah, I was considering that.
I think I just found out about one of the issues though: The router doesn't recognize my computers as connected, only some others.
I think this may be due to the fact, that my XP machine is running a bridged network, attached to a WLAN AP in client mode...
Will do some packet sniffing as soon as I can be bothered..
Oh, as for the discovery of the upnp device by windows: that was when I wasn't running the bridge, and wasn't using an AP as client, but a PCI card...
Back to top
View user's profile Send private message
Rick



Joined: 10 Dec 2008
Posts: 10

PostPosted: Thu Dec 11, 2008 10:15 am    Post subject: Reply with quote

I think one of the issues is identified, because the router detects only my AP as sole client (because it has its own IP and MAC adress) and for some reason, even though it serves DHCP to the other clients doesn't recognize them as connected.
The AP claims that it does MAC translation, but apparently not transparently enough. I am considering using Mac Cloning on the AP now, but then probably the machines behind the winxp bridge will no longer be able to receive any packets at all.
I'm not really in the know about Upnp, but does the gateway have to ackowledge the existence of the clients, even when they're on the LAN and talking to it?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Dec 11, 2008 4:40 pm    Post subject: Reply with quote

What could be the source of problems within a Bridged LAN is the sopport of Multicast trafic by your AP.
UPnP Discovery process use IP multicasting which is often badly supported by network equipements (routers, etc..)
miniupnpc can skip the discovery process : use the -u option :
Code:
~$ upnpc -u http://192.168.11.1:4666/rootDesc.xml -l

_________________
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: Thu Dec 11, 2008 4:43 pm    Post subject: Reply with quote

once the discovery process is done, all communication between a UPnP IGD and a client are through TCP connections (HTTP) so in your case it should work.
Some client and IGDs check that they are on the same subnetwork but I don't think it is your case.
ex: win2k IGD wont talk to 192.168.33.22 if it's ip is 192.168.1.1
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Rick



Joined: 10 Dec 2008
Posts: 10

PostPosted: Thu Dec 11, 2008 5:27 pm    Post subject: Reply with quote

No, they're all in 192.168.1.255, and the IGD -does- get discovered.
(see the first line about the discovered IGD device being not connected)
I don't quite know what the "connected" refers to, though.
Once home, I'll play a bit more with the options though.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Fri Dec 12, 2008 12:04 am    Post subject: Reply with quote

yep. sorry...
btw, 401 is "Invalid Action"... strange !
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Rick



Joined: 10 Dec 2008
Posts: 10

PostPosted: Sun Dec 14, 2008 12:28 pm    Post subject: Reply with quote

So, I've grabbed the packets, and this is what's happening:

client:
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:GetExternalIPAddress xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
</u:GetExternalIPAddress>
</s:Body>
</s:Envelope>

igd:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP:Body>
<u:GetExternalIPAddressResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
<NewExternalIPAddress xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:type="string">83.77.12.4</NewExternalIPAddress>
</u:GetExternalIPAddressResponse>
</SOAP:Body>
</SOAP:Envelope>

client:

<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:DeletePortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>61907</NewExternalPort>
<NewProtocol>UDP</NewProtocol>
</u:DeletePortMapping>
</s:Body>
</s:Envelope>


igd:
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP:Body>
<u:DeletePortMappingResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
</u:DeletePortMappingResponse>
</SOAP:Body>
</SOAP:Envelope>

and deleting a mapping:

client:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:DeletePortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost><NewExternalPort>54550</NewExternalPort><NewProtocol>TCP</NewProtocol></u:DeletePortMapping>
</s:Body>
</s:Envelope>

igd:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP:Body>
<u:DeletePortMappingResponse xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
</u:DeletePortMappingResponse>
</SOAP:Body>
</SOAP:Envelope>


....I haven't compared that yet to what miniupnpc is doing, but apparently it's subtly different.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Sun Dec 14, 2008 12:49 pm    Post subject: Reply with quote

you posted only DeletePortMapping. What about AddPortMapping so I could compare.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Rick



Joined: 10 Dec 2008
Posts: 10

PostPosted: Sun Dec 14, 2008 1:38 pm    Post subject: Reply with quote

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost><NewExternalPort>49605</NewExternalPort><NewProtocol>UDP</NewProtocol><NewInternalPort>49605</NewInternalPort><NewInternalClient>192.168.1.57</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>uTorrent (UDP)</NewPortMappingDescription><NewLeaseDuration>0</NewLeaseDuration></u:AddPortMapping>
</s:Body>
</s:Envelope>


..this resulted in a conflicting mapping, but at least it got that far.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Dec 15, 2008 11:34 am    Post subject: Reply with quote

Rick wrote:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost><NewExternalPort>49605</NewExternalPort><NewProtocol>UDP</NewProtocol><NewInternalPort>49605</NewInternalPort><NewInternalClient>192.168.1.57</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>uTorrent (UDP)</NewPortMappingDescription><NewLeaseDuration>0</NewLeaseDuration></u:AddPortMapping>
</s:Body>
</s:Envelope>


..this resulted in a conflicting mapping, but at least it got that far.

here is what gives miniupnpc :
Code:
POST /ctl/IPConn HTTP/1.1
Host: 192.168.11.1:4666
User-Agent: POSIX, UPnP/1.0, miniUPnPc/1.0
Content-Length: 587
Content-Type: text/xml
SOAPAction: "urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"
Connection: Close
Cache-Control: no-cache
Pragma: no-cache


<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><m:AddPortMapping xmlns:m="urn:schemas-upnp-org:service:WANIPConnection:1"><NewRemoteHost></NewRemoteHost><NewExternalPort>456</NewExternalPort><NewProtocol>UDP</NewProtocol><NewInternalPort>123</NewInternalPort><NewInternalClient>1.2.3.4</NewInternalClient><NewEnabled>1</NewEnabled><NewPortMappingDescription>libminiupnpc</NewPortMappingDescription><NewLeaseDuration>0</NewLeaseDuration></m:AddPortMapping></s:Body></s:Envelope>

I don't see any difference except the namespace prefix for urn:schemas-upnp-org:service:WANIPConnection:1
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Rick



Joined: 10 Dec 2008
Posts: 10

PostPosted: Mon Dec 15, 2008 12:50 pm    Post subject: Reply with quote

If you could give me a pointer where in the source code of miniupnpc that is set, I could try to just change it from m to u.

since the IGD answers with "u" maybe that's all there is to it.

How come btw, that occasionally discovery (consistently) fails on my linux box (behind the bridge) while it works on the XP box (being the bridge)?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Dec 15, 2008 5:16 pm    Post subject: Reply with quote

Rick wrote:
If you could give me a pointer where in the source code of miniupnpc that is set, I could try to just change it from m to u.

since the IGD answers with "u" maybe that's all there is to it.

How come btw, that occasionally discovery (consistently) fails on my linux box (behind the bridge) while it works on the XP box (being the bridge)?

Code:

diff -u -r1.56 miniupnpc.c
--- miniupnpc.c 15 Oct 2008 11:36:09 -0000      1.56
+++ miniupnpc.c 15 Dec 2008 17:15:39 -0000
@@ -156,8 +156,8 @@
                                                  "xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
                                                  SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
                                                  "<" SOAPPREFIX ":Body>"
-                                                 "<m:%s xmlns:m=\"%s\">"
-                                                 "</m:%s>"
+                                                 "<u:%s xmlns:u=\"%s\">"
+                                                 "</u:%s>"
                                                  "</" SOAPPREFIX ":Body></" SOAPPREFIX ":Envelope>"
                                                  "\r\n", action, service, action);
        }
@@ -172,7 +172,7 @@
                                                "xmlns:" SOAPPREFIX "=\"http://schemas.xmlsoap.org/soap/envelope/\" "
                                                SOAPPREFIX ":encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
                                                "<" SOAPPREFIX ":Body>"
-                                               "<m:%s xmlns:m=\"%s\">",
+                                               "<u:%s xmlns:u=\"%s\">",
                                                action, service);
                p = soapbody + soapbodylen;
                while(args->elt)
@@ -204,7 +204,7 @@
                }
                *(p++) = '<';
                *(p++) = '/';
-               *(p++) = 'm';
+               *(p++) = 'u';
                *(p++) = ':';
                pe = action;
                while(*pe)

_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Rick



Joined: 10 Dec 2008
Posts: 10

PostPosted: Sat Dec 20, 2008 1:27 pm    Post subject: Reply with quote

tried it now, and no success Sad

I'm going to try some netcat / telnet experimentation, maybe that will reveal more...

just noticed while handcrafting packets, that utorrent upnp does its xml in CRLF format, with loads of \r\n in the http header as well as in the upnp xmp post.
is miniupnpc doing the same, or is that relevant at all?

Had a look at the code, and it appears you are adding some fo the \r\n's but nto quite as many as utorrent does, here's a list of them:

first, in the HTTP header:
after every line one (POST, LENGTH, TYPE), after the SOAPACTION line two

in the xml: as you did, one after the version,
one after the encoding, and one after <s:Body>
one after every set of commands in <s:Body>, and after </s:Body>
one at the very end.

Unless I am mistaken, a few of those were absent in miniupnpc.c?
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 -> miniupnpc Bugs 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.