bitletorg / weupnp

A tiny UPnP (Universal Plug and Play) client library written in Java
http://bitletorg.github.io/weupnp
100 stars 36 forks source link

Consider workaround for Linksys UPNP bugs #12

Open mikehearn opened 10 years ago

mikehearn commented 10 years ago

As documented here:

http://www.upnp-hacks.org/annoyances.html

Linksys devices (very common) have an unbelievable and infuriating bug. They can support a max of 32 UPnP mappings, but the table is persisted across device reboots. This means that over time Linksys routers decay and rot because their UPnP table fills up with dead mappings created by crashed programs or devices. Eventually you hit the 32 entry limit. There is no way to clean the table or even know this has happened via the web UI and best of all .... wait for it .... the device continues to accept new mapping requests without serving any errors. It just silently fails to do what it claims it's doing.

The Java PortMapper tool that uses weupnp can be used to clean this situation by removing dead mappings. WeUPnP could theoretically have a workaround for this stupidity by detecting the combination of:

If it detects this case, then it could scan to find closed ports and remove the mappings for them, thus unbreaking the device!

I know it's pretty stupid and ugly, but it'd help make UPnP more reliable for apps using this library.