Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in UPnP ver. 3.1.4 #75

Open
KingCrimson138 opened this issue Jun 7, 2023 · 6 comments
Open

Error in UPnP ver. 3.1.4 #75

KingCrimson138 opened this issue Jun 7, 2023 · 6 comments

Comments

@KingCrimson138
Copy link

Testing WiFi connection for [192.168.0.19] ==> GOOD
Testing internet connection ==> GOOD
isGatewayInfoValid [(IP unset)] port [0] path [] actionPort [0] actionPath [] serviceTypeName []
Gateway info is not valid

Sending M-SEARCH to [239.255.255.250] Port [1900]
M-SEARCH sent
Received packet of size [314] ip [192.168.0.1] port [1900]
UDP packet read bytes [314] out of [314]
Gateway packet content:
HTTP/1.1 200 OK
Cache-Control: max-age=1900
Location: http://192.168.0.1:80/RootDevice.xml
Server: UPnP/1.0 UPnP/1.0 UPnP-Device-Host/1.0
ST:urn:schemas-upnp-org:device:InternetGatewayDevice:1
USN: uuid:upnp-InternetGatewayDevice-1_0-083e5d4e849c::urn:schemas-upnp-org:device:InternetGatewayDevice:1
EXT:

INTERNET_GATEWAY_DEVICE found
IGD location found [http://192.168.0.1:80/RootDevice.xml]
192.168.0.1
80
/RootDevice.xml
Connecting to IGD with host [192.168.0.1] port [80]
Connected to IGD
called getIGDEventURLs
deviceInfo->actionPath [] deviceInfo->path [/RootDevice.xml]
TCP connection timeout while executing getIGDEventURLs
called getIGDEventURLs
deviceInfo->actionPath [] deviceInfo->path [/RootDevice.xml]
TCP connection timeout while executing getIGDEventURLs
called getIGDEventURLs
deviceInfo->actionPath [] deviceInfo->path [/RootDevice.xml]
TCP connection timeout while executing getIGDEventURLs
Timeout expired while adding a new port mapping
ERROR: Invalid router info, cannot continue

isGatewayInfoValid [192.168.0.1] port [80] path [/RootDevice.xml] actionPort [80] actionPath [] serviceTypeName []
Gateway info is valid

I had already tested this library on an esp8266 to open the ports of a router. Now I am on another router (home like) and I get this error. I tried to delete a debugPrint(line); that a user had used but it didn't change. Thank you for your answer I am desperate for solutions :)

Line of code:

portMappingResult portMappingAdded;
//Setting router ports by UPnP
tinyUPnP.addPortMappingConfig(WiFi.localIP(), LISTEN_PORT, RULE_PROTOCOL_TCP, LEASE_DURATION, FRIENDLY_NAME);
while (portMappingAdded != SUCCESS && portMappingAdded != ALREADY_MAPPED) {
portMappingAdded = tinyUPnP.commitPortMappings();
Serial.println("");

if (portMappingAdded != SUCCESS && portMappingAdded != ALREADY_MAPPED) {
 
  tinyUPnP.printAllPortMappings();
  Serial.println(F("Port mapping failed"));
  delay(30000);  // 30 seconds
}

}

Serial.println("Port forwarding done");
Consts:
#define LISTEN_PORT 2400
#define LEASE_DURATION 36000
#define FRIENDLY_NAME "HidroSrv"

@ofekp
Copy link
Owner

ofekp commented Jun 12, 2023

Can you describe your home setup, is it just one router?
Can you verify that UPnP is enabled on that router, please?
Can you download http://192.168.0.1:80/RootDevice.xml and attach it here as a file?
Thanks

@KingCrimson138
Copy link
Author

Hi, thanks for replying, yes it is a single router and I did indeed check that UPnP was enabled.
Here is the xml.
1 0 http://192.168.0.1:80 urn:schemas-upnp-org:device:InternetGatewayDevice:1 SAGEM F@ST3686 SAGEM http://www.broadcom.com F@ST3686 F@ST3686 F@ST3686 http://www.broadcom.com (unimplemented) uuid:upnp-InternetGatewayDevice-1_0-083e5d4e849c (unimplemented) urn:schemas-upnp-org:service:Layer3Forwarding:1 urn:upnp-org:serviceId:L3Forwarding1 /Layer3Forwarding.xml /Layer3Forwarding /Layer3Forwarding urn:schemas-upnp-org:device:WANDevice:1 SAGEM F@ST3686 SAGEM http://www.broadcom.com F@ST3686 F@ST3686 F@ST3686 http://www.broadcom.com (unimplemented) uuid:upnp-WANDevice-1_0-083e5d4e849c (unimplemented) urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 urn:upnp-org:serviceId:WANCommonIFC1 /WANCommonInterfaceConfig.xml /WANCommonInterfaceConfig /WANCommonInterfaceConfig urn:schemas-upnp-org:device:WANConnectionDevice:1 SAGEM F@ST3686 SAGEM http://www.broadcom.com F@ST3686 F@ST3686 F@ST3686 http://www.broadcom.com (unimplemented) uuid:upnp-WANConnectionDevice-1_0-083e5d4e849c (unimplemented) urn:schemas-upnp-org:service:WANIPConnection:1 urn:upnp-org:serviceId:WANIPConn1 /WANIPConnection.xml /WANIPConnection /WANIPConnection /

@ofekp
Copy link
Owner

ofekp commented Jun 12, 2023

OK, this is not an XML format, but I assume this is a formatting issue (which I why I always request to attach as a file).
Nevertheless, I want you to try to get the latest code and run this again.
Please note that there were a few changes and contributions since I last updated the version of the package, so you're probably not running the latest codebase.
You will need to copy the code (https://github.com/ofekp/TinyUPnP/tree/master) into the Libraries directory, e.g. C:\arduino-1.8.9\libraries then you will need to reload the package.
To make sure you are using the new code, I suggest inserting a print message that you will recognize, or inserting a compilation error and verifying that it won't compile.
As an example, after you copy the code to the libraries dir, the source files will be in this directory:
C:\arduino-1.8.9\libraries\TinyUPnP\src
Please try to run again with the updated code.
If this works, I will update the package version.

@KingCrimson138
Copy link
Author

I'm sorry, I have not attached the file because I was on my phone and I have not found the add file button and my mistake was to open it in the web browser, it opened in html plain text sorry. anyway anyway now I am on the PC and now I can attach the file.
I just tried the new version and I still have the problem.
RootDevice.zip

@ofekp
Copy link
Owner

ofekp commented Jun 13, 2023

No worries :)

Next up:

  1. Please run the new code like you already did, but enable debug prints by uncommenting this line https://github.com/ofekp/TinyUPnP/blob/master/src/TinyUPnP.h#L15
  2. Save the log into a file after it ran for >2 iterations and attach it here
  3. Attach the file found at the location http://192.168.0.1:80/WANIPConnection.xml (it is one of the paths depicted in RootDevice.xml from your previous comment).

Please attach the files without zipping them, thank you.

@ofekp
Copy link
Owner

ofekp commented Jul 1, 2023

@KingCrimson138 kind reminder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants