tailscale: UPnP port map fails on Mikrotik CHR v7.10 with a UPnPError

What is the issue?

UPNP fails to map ports from a Mikrotik CHR using PnP fails with a UPnP error:

[tw@nuc ~]$ sudo tailscale debug portmap
gw=10.0.0.1; self=10.0.0.34
portmapper: [v1] UPnP reply {Location:http://10.0.0.1:2828/gateway.xml Server:RouterOS/7.7UPnP/1.0 MikroTik UPnP/1.0 USN:uuid:UUID-MIKROTIK-INTERNET-GATEWAY-DEVICE-::urn:schemas-upnp-org:device:InternetGatewayDevice:1}, "HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=3600\r\nEXT: \r\nLOCATION: http://10.0.0.1:2828/gateway.xml\r\nSERVER: RouterOS/7.7UPnP/1.0 MikroTik UPnP/1.0\r\nST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\nUSN: uuid:UUID-MIKROTIK-INTERNET-GATEWAY-DEVICE-::urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n\r\n"
portmapper: UPnP meta changed: {Location:http://10.0.0.1:2828/gateway.xml Server:RouterOS/7.7UPnP/1.0 MikroTik UPnP/1.0 USN:uuid:UUID-MIKROTIK-INTERNET-GATEWAY-DEVICE-::urn:schemas-upnp-org:device:InternetGatewayDevice:1}
portmapper: [v1] UPnP reply {Location:http://10.0.0.1:2828/gateway.xml Server:RouterOS/7.7UPnP/1.0 MikroTik UPnP/1.0 USN:uuid:UUID-MIKROTIK-INTERNET-GATEWAY-DEVICE-::urn:schemas-upnp-org:device:InternetGatewayDevice:1}, "HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=3600\r\nEXT: \r\nLOCATION: http://10.0.0.1:2828/gateway.xml\r\nSERVER: RouterOS/7.7UPnP/1.0 MikroTik UPnP/1.0\r\nST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\nUSN: uuid:UUID-MIKROTIK-INTERNET-GATEWAY-DEVICE-::urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n\r\n"
portmapper: [v1] UPnP reply {Location:http://10.0.0.1:2828/gateway.xml Server:RouterOS/7.7UPnP/1.0 MikroTik UPnP/1.0 USN:uuid:UUID-MIKROTIK-INTERNET-GATEWAY-DEVICE-::urn:schemas-upnp-org:device:InternetGatewayDevice:1}, "HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=3600\r\nEXT: \r\nLOCATION: http://10.0.0.1:2828/gateway.xml\r\nSERVER: RouterOS/7.7UPnP/1.0 MikroTik UPnP/1.0\r\nST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\nUSN: uuid:UUID-MIKROTIK-INTERNET-GATEWAY-DEVICE-::urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n\r\n"
Probe: {PCP:false PMP:false UPnP:true}
no mapping
portmapper: fetching http://10.0.0.1:2828/gateway.xml
portmapper: saw UPnP type WANIPConnection1 at http://10.0.0.1:2828/gateway.xml; MikroTik Router (MikroTik)
portmapper: getUPnPClient: *internetgateway2.WANIPConnection1, <nil>
portmapper: addAnyPortMapping: 5050, err="SOAP fault: UPnPError"
serveDebugPortmap: context done: context deadline exceeded

Steps to reproduce

No response

Are there any recent changes that introduced the issue?

No response

OS

Linux, macOS, Windows, Android

OS version

Archlinux

Tailscale version

1.42.0-dev20230524

Other software

No response

Bug report

BUG-ee4bbbf9cbe5d3499aea8dc1c3bb73ea626a554b7838ef8a0aa6b988964f7bf4-20230617120209Z-eae3a7b4231b6bf8

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Can do, I will have to replicate the exact conditions tonight when I get home, as my WANscape(ugh) has changed slightly

Reading over the patches, come to think of it, instead of selecting the first external gateway, wouldn’t it be better to add portmaps to all endpoints that are offered and externally reachable in the nodemap?

@tylerjwatson Great! Just confirmed that the changes in #10489 work for your Mikrotik; it was able to probe both URLs and pick the working one, then successfully obtain a portmapping. I left the log in the homedir as portmap.log, if you’re curious.

Once that PR is reviewed + merged, I’ll build an unstable release and leave another comment here, and it’ll end up in the stable release 1.58, which we’ll build sometime in early 2024.

Also: I really appreciate the help with debugging this; it was great. Folks like you are a maintainers’ dream–so thanks 😃