ofekp / TinyUPnP

A very small UPnP IGD implementation for your ESP8266 for automatic port forwarding
GNU Lesser General Public License v2.1
103 stars 15 forks source link

WANIPConnection - WANPPPConnection #33

Closed xan86 closed 5 years ago

xan86 commented 5 years ago

there are explicit uses of the WANPPPConnection service even if if the serviceTypeName is WANIPConnection, I suggest to replace:

strcat_P(body_tmp, PSTR(" xmlns:u=\"urn:schemas-upnp-org:service:WANPPPConnection:1\">\r\n<NewRemoteHost></NewRemoteHost>\r\n<NewExternalPort>"));

with:

  strcat_P(body_tmp, PSTR(" xmlns:u=\""));
  strcat_P(body_tmp, deviceInfo->serviceTypeName.c_str());
  strcat_P(body_tmp, PSTR("\">\r\n<NewRemoteHost></NewRemoteHost>\r\n<NewExternalPort>"));

and: _wifiClient.print(F("SOAPAction: \"urn:schemas-upnp-org:service:WANPPPConnection:1#"));

with:

  _wifiClient.print(F("SOAPAction: \""));
  _wifiClient.print(deviceInfo->serviceTypeName);
  _wifiClient.print(F("#"));

also my router responds with service "WANIPConnection:2" I swapped 1 in 2 in:

const String UPNP_SERVICE_TYPE_2 = "urn:schemas-upnp-org:service:WANIPConnection:1";

it worked for me, but I don't think it's the right solution

ofekp commented 5 years ago
  1. 🏁 done.
  2. 🏁 done.
  3. Interesting, you possess a second version IGD. You are truly blessed. I made the code tolerant to the version number changing. It will help a lot if you can load versionedIGD branch and test it with you setup.

I love these kinds of contributions, it makes the difference between someone using the package effortlessly and someone being frustrated from it not working.

Thank you.

xan86 commented 5 years ago

I confirm that versionedIGD works with WANIPConnection:2 Just tested, it perfectly forwards the http service port!

Thank you.

ofekp commented 5 years ago

Not a problem. Thank you very much for the confirmation.