TinyUPnP icon indicating copy to clipboard operation
TinyUPnP copied to clipboard

Gateway info is not valid

Open rugal0123 opened this issue 5 years ago • 98 comments

Greeting, i tried to use your libraries to test on my esp32 and somehow end up with this error. I've tried with 2 different router, 1 is my ASUS TM- AC 1900 and the other is my Samsung S7 Mobile HotSpot and Tethering. I've double checked on the require "filled_in" info and tried with different listen port, also tried to change the LEASE_DURATION. Please help i'm getting lost...

error_UPNP

rugal0123 avatar Feb 01 '20 02:02 rugal0123

No device on your network responded to the M-SEARCH message.

Can you confirm that your internal network is 192.168.29.0? do the routers have the same address format (except for the last number)? Can you please check that you router has UPnP enabled?

I do not know Samsung S7 Mobile HotSpot but I am guessing it is cellular network? I am not sure this can work since cellular networks to not give you much control, so I am not sure you will be able to check what I asked on this router.

ofekp avatar Feb 02 '20 14:02 ofekp

Hi ofekp, thanks for the response. I'm able to setup port forwarding manually and verify it's working with my router by connecting to my esp32 from outside network. But i have no luck with trying to implement the libraries. I also set the UpnP feature enable at first. Yes, the Samsung S7 Hotspot is just the cellular network as a 2nd test case for me. I was hoping it should work with my Asus router as first. image

rugal0123 avatar Feb 02 '20 17:02 rugal0123

This seems to be related to issue https://github.com/ofekp/TinyUPnP/issues/35 I have merged the code few week ago, but it is not deployed to the Arduino Library Manager yet.

Can you take the code from master branch and try again? Simply use the code as you see it GitHub rather than use the library from the Library Manager.

Let me know how it went please.

ofekp avatar Feb 03 '20 00:02 ofekp

I just deleted the libraries and used the latest from GitHub as you recommended but still no luck. Same result again, my router completely ignored the M-SEARCH message... image I've checked the router log to verify the Upnp feature is enabled image

rugal0123 avatar Feb 03 '20 01:02 rugal0123

why is it listening on 5351? Is that the UPnP? should be 1900... Do you have access to 'upnpc' bash program? If so please show me the output for upnpc -l

Make sure it looks like this: image

I did see a post about issues with UPnP specifically with your router: https://community.t-mobile.com/thread/140179

Have you tried that firmware update?

ofekp avatar Feb 04 '20 22:02 ofekp

I just bought a new asus router RT-AX58U to try but still got the same result after update the firmware to latest... image image

I'm not sure about the 'upnpc' bash program but this is the log report from the router web page after i disabled and re-enabled the UPnP service. No idea why all Asus router keep listening on port 5351 by default... image image I guess Asus routers doesn't work at all..

rugal0123 avatar Feb 05 '20 02:02 rugal0123

I am not yet sure it actually means they listen on that port, it might mean something else.

Can you please read this short post and perform the actions described in it? https://zapek.com/blog/how-to-fix-upnp-igd-not-working-on-asus-rt-ac87u/

ofekp avatar Feb 05 '20 07:02 ofekp

Yes i've tried that also but not working either. For the RT-AX58U router, look like they have the "IGMP snooping" feature enabled by default. image

rugal0123 avatar Feb 05 '20 09:02 rugal0123

Can you change this line to the 5351 port: https://github.com/ofekp/TinyUPnP/blob/master/src/TinyUPnP.h#L16

If that does not work, please restore 1900 port.

Then, we'll need to set you up with upnpc tool. Do you have a linux env somewhere? Old computer, Raspberry Pi? Anything?

ofekp avatar Feb 05 '20 09:02 ofekp

Hi ofekp, i did try to mess with the port number from your source code. I just read that Asus router doesn't allow Upnp feature to the WAN, LAN devices only... I guess that's why no matter if i turn on or off Upnp feature there's no response at all... Here's the discussion: https://www.snbforums.com/threads/new-upnp-exploit-affecting-most-asus-routers-upnproxy-blackhat-proxies-via-nat-injections.46011/ Maybe i will swap out with another router with different brand tomorrow to see how's the library works ...

rugal0123 avatar Feb 05 '20 09:02 rugal0123

That looks unfortunate... But since you are contacting the router from the LAN I still don't think it should be a problem. The router should respond to M-SEARCH messages coming from the LAN, wifi or not...

I am willing to keep looking for the issue, but we will need to execute upnpc commands from within the LAN.

Do you have any other device in your network that is using UPnP and puts rules dynamically in your router?

ofekp avatar Feb 06 '20 16:02 ofekp

yes, you are right. I just tried with a Netgear router and still no different... Currently, i don't have any device that using UPnP in my network. image image

rugal0123 avatar Feb 06 '20 18:02 rugal0123

The plot thickens! Please describe your network to me. Nice and easy, I want to know how many routers you have specifically. How many switches, how many devices. Anything you can think of please.

I found a workaround for upnpc command in windows environment:

  • go to http://miniupnp.free.fr/files/
  • look for "latest files"
  • in the table, find the one file that is called "upnpc-exe" (upnpc-exe-win32-20150918)
  • download the folder and extract it somewhere (no installation needed)
  • open win terminal (command prompt)
  • enter the following command (change the folder path as needed): C:\Users\user-name>C:\Users\user-name\Downloads\upnpc-exe-win32-20150918\upnpc-shared.exe -l

Then please copy paste the output here.

I still need to know the layout of your network too.

ofekp avatar Feb 06 '20 18:02 ofekp

I use Comcast cable internet and have only 1 modem and 1 router. Currently running with 1 raspberry Pi that i can connect remotely with tightvnc service, 2 smart plug devices that i can control from anywhere, 1 PS4 and several mobile devices (iphones) and Smart TVs... very standard i think.

rugal0123 avatar Feb 06 '20 19:02 rugal0123

OK, sounds standard, please try the upnpc for windows and and let's see what we get.

ofekp avatar Feb 06 '20 20:02 ofekp

Hi ofekp, I just ran the tool you suggested and here's the output... image

rugal0123 avatar Feb 06 '20 23:02 rugal0123

Made a PR for you, if you feel adventurous (I have yet to test on my device) please give it a shot: https://github.com/ofekp/TinyUPnP/pull/53

Updated the PR. Please make sure to use commit with hash 94dc6cb, thanks.

ofekp avatar Feb 06 '20 23:02 ofekp

I've compiled and use the new version #94dc6cb you provided but same error... image

rugal0123 avatar Feb 07 '20 08:02 rugal0123

Darn, I made a mistake that caused it to behave the same... new hash is b375e92

But please note that the output indicates that you're using the library from Arduino Library Manager and not from the branch I created.

You'll need to go to the folder where the package is and override the code there in both .h file and .cpp file. Folder should look something like this: D:\arduino-1.8.9\libraries\TinyUPnP\src There you'll find the files that you need to change.

ofekp avatar Feb 07 '20 11:02 ofekp

I've deleted the old library from Arduino Library Manager and use the branch that you created. The output displayed different but still no luck...

image

rugal0123 avatar Feb 07 '20 17:02 rugal0123

Still timeout? Can you please attach a text file of the output in following posts?

Seems like your Netgear router is also prone to UPnP issues: https://community.netgear.com/t5/General-WiFi-Routers-Non/UPnP-still-broken-on-R6400/m-p/1639401

The claim that: "UPnP is fixed by R6400 firmware version 1.0.1.46."

Can you please check what firmware you're running there?

ofekp avatar Feb 07 '20 17:02 ofekp

Here's the output file output.txt The version i got is newer 1.0.4.84. image

rugal0123 avatar Feb 07 '20 18:02 rugal0123

so no "timeout" message after the M-SEARCH is sent? Did you wait long enough?

ofekp avatar Feb 07 '20 18:02 ofekp

Yes, i didn't capture all of them in the text file. My bad. This is the full log. output.txt

rugal0123 avatar Feb 07 '20 18:02 rugal0123

Added another device type, please give the PR another try.

ofekp avatar Feb 07 '20 19:02 ofekp

Just did. Same result. Here's the log. output2.txt

rugal0123 avatar Feb 07 '20 19:02 rugal0123

Can you type in the path to the xml file in your browser that was printed by the upnpc command that you attached in this comment and attach the result here please?

ofekp avatar Feb 07 '20 20:02 ofekp

Hi ofekp, this is what i got after entered the info you asked logfile.txt

rugal0123 avatar Feb 08 '20 01:02 rugal0123

Now this please: http://192.168.1.1:5000/Public_UPNP_WANIPConn.xml

And this: http://192.168.1.1:5000/Public_UPNP_WANPPPConn.xml

And this: http://192.168.1.1:5000/Public_UPNP_Layer3F.xml

😄

ofekp avatar Feb 08 '20 23:02 ofekp