Transmission can't see UPnP on router

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
kirin64
Posts: 4
Joined: Sat May 12, 2012 1:18 pm

Transmission can't see UPnP on router

Post by kirin64 »

I recently got a new router (Belkin N600 DB), and Transmission doesn't seem to be able to see its UPnP interface to open ports. Here's the relevant section of the log:

Code: Select all

2012-05-12 12:55:15 +0000 natpmp.c:72 [Info] Port Forwarding (NAT-PMP): initnatpmp succeeded (0)
2012-05-12 12:55:15 +0000 natpmp.c:72 [Info] Port Forwarding (NAT-PMP): sendpublicaddressrequest succeeded (2)
2012-05-12 12:55:15 +0000 upnp.c:104 [Debug] Port Forwarding (UPnP): upnpDiscover failed (errno 0 - Undefined error: 0)
2012-05-12 12:55:15 +0000 upnp.c:214 [Debug] Port Forwarding (UPnP): UPNP_GetValidIGD failed (errno 0 - Undefined error: 0)
2012-05-12 12:55:15 +0000 upnp.c:217 [Debug] Port Forwarding (UPnP): If your router supports UPnP, please make sure UPnP is enabled!
2012-05-12 12:55:15 +0000 port-forwarding.c:93 [Info] Port Forwarding: State changed from "Not forwarded" to "Starting"
2012-05-12 12:55:23 +0000 natpmp.c:77 [Debug] Port Forwarding (NAT-PMP): readnatpmpresponseorretry failed. Natpmp returned -7 (the gateway does not support nat-pmp); errno is 61 (Connection refused)
2012-05-12 12:55:23 +0000 port-forwarding.c:93 [Info] Port Forwarding: State changed from "Starting" to "???"
This happens on both the current stable (2.51) and nightly build 13295, running on OS X 10.7.4. UPnP is definitely enabled on the router, and other applications have been able to map ports, both on this Mac and other devices. UPnP Port Mapper can both list current UPnP mappings on the router, and create new ones. Here's the info it manages to scrape from the router:

Code: Select all

INFO  Router Info: friendlyName 	= Belkin N600DB Wireless Modem Router
INFO  Router Info: manufacturer 	= Belkin International Inc.
INFO  Router Info: manufacturerURL 	= http://www.Belkin.com
INFO  Router Info: modelDescription 	= Wireless Modem Router with Ethernet Switch
INFO  Router Info: modelName 	= Belkin N600DB Wireless Modem Router
INFO  Router Info: modelNumber 	= F9J1102 v1
INFO  Router Info: modelURL 	= http://www.Belkin.com
INFO  Router Info: presentationURL 	= http://192.168.2.1
INFO  Router Info: serialNumber 	= 121151HF105955
INFO  Router Info: urlBase 	= http://192.168.2.1:1780
INFO  Router Info: vendorFirmware 	= POSIX UPnP/1.0 linux/1.00.09
INFO  def loc http://192.168.2.1:1780/InternetGatewayDevice.xml
INFO  def loc data <?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
	<specVersion>
		<major>1</major>
		<minor>0</minor>
	</specVersion>
	<device>
		<deviceType>urn:schemas-upnp-org:device:InternetGatewayDevice:1</deviceType>
		<friendlyName>Belkin N600DB Wireless Modem Router</friendlyName>
		<manufacturer>Belkin International Inc.</manufacturer>
		<manufacturerURL>http://www.Belkin.com</manufacturerURL>
		<modelDescription>Wireless Modem Router with Ethernet Switch</modelDescription>
		<modelName>Belkin N600DB Wireless Modem Router</modelName>
		<modelNumber>F9J1102 v1</modelNumber>
		<serialNumber>121151HF105955</serialNumber>
		<modelURL>http://www.Belkin.com</modelURL>
		<UDN>uuid:d5ee262f-940c-2f49-efdd-b38448aa16af</UDN>
		<serviceList>
			<service>
				<serviceType>urn:schemas-upnp-org:service:Layer3Forwarding:1</serviceType>
				<serviceId>urn:upnp-org:serviceId:L3Forwarding1</serviceId>
				<SCPDURL>/x_layer3forwarding.xml</SCPDURL>
				<controlURL>/control?Layer3Forwarding</controlURL>
				<eventSubURL>/event?Layer3Forwarding</eventSubURL>
			</service>
		</serviceList>
		<deviceList>
			<device>
				<deviceType>urn:schemas-upnp-org:device:WANDevice:1</deviceType>
				<friendlyName>WANDevice</friendlyName>
				<manufacturer>Belkin International</manufacturer>
				<manufacturerURL>http://www.Belkin.com</manufacturerURL>
				<modelDescription>Wireless Modem Router with Ethernet Switch</modelDescription>
				<modelName>Wireless Modem Router</modelName>
				<modelURL>http://www.Belkin.com</modelURL>
				<UDN>uuid:b49c4bf4-145e-7a61-cb15-676459634f16</UDN>
				<serviceList>
					<service>
						<serviceType>urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1</serviceType>
						<serviceId>urn:upnp-org:serviceId:WANCommonIFC1</serviceId>
						<SCPDURL>/x_wancommoninterfaceconfig.xml</SCPDURL>
						<controlURL>/control?WANCommonInterfaceConfig</controlURL>
						<eventSubURL>/event?WANCommonInterfaceConfig</eventSubURL>
					</service>
				</serviceList>
				<deviceList>
					<device>
						<deviceType>urn:schemas-upnp-org:device:WANConnectionDevice:1</deviceType>
						<friendlyName>WAN Connection Device</friendlyName>
						<manufacturer>Belkin International</manufacturer>
						<manufacturerURL>http://www.Belkin.com</manufacturerURL>
						<modelDescription>Wireless Modem Router with Ethernet Switch</modelDescription>
						<modelName>Wireless Modem Router</modelName>
						<modelURL>http://www.Belkin.com</modelURL>
						<UDN>uuid:60ee7aea-6a61-7b8b-163c-1cfe8f18b5dd</UDN>
						<serviceList>
							<service>
								<serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType>
								<serviceId>urn:upnp-org:serviceId:WANIPConn1</serviceId>
								<SCPDURL>/x_wanipconnection.xml</SCPDURL>
								<controlURL>/control?WANIPConnection</controlURL>
								<eventSubURL>/event?WANIPConnection</eventSubURL>
							</service>
						</serviceList>
					</device>
				</deviceList>
			</device>
		</deviceList>
		<presentationURL>http://192.168.2.1</presentationURL>
	</device>
</root>


INFO  icons null
INFO  device type urn:schemas-upnp-org:device:InternetGatewayDevice:1
INFO  direct parent null
INFO  disc udn uuid:d5ee262f-940c-2f49-efdd-b38448aa16af
INFO  disc usn uuid:d5ee262f-940c-2f49-efdd-b38448aa16af::urn:schemas-upnp-org:device:InternetGatewayDevice:1
INFO  udn uuid:d5ee262f-940c-2f49-efdd-b38448aa16af
Any ideas would be appreciated :D
kirin64
Posts: 4
Joined: Sat May 12, 2012 1:18 pm

Re: Transmission can't see UPnP on router

Post by kirin64 »

x190 wrote:viewtopic.php?f=2&t=13405#p60246

Search portforward.com for your router.
Thanks. I know I can manually forward ports; I was just wondering if anyone has any insight into why Transmission specifically seems to have issues with UPnP on this router. That, and this router can't do static IP assignments, so manually forwarding the ports is decidedly brittle.
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Transmission can't see UPnP on router

Post by rb07 »

kirin64 wrote:why Transmission specifically seems to have issues with UPnP on this route
Transmission uses miniupnp, so first see if your router is in the supported list: http://miniupnp.free.fr/devicelist.php

If its not in the list, no problem, it may be supported just not in the list.

But (and this is the most common problem) Transmission uses that library ignoring any router with a buggy interface. In other words, if the router doesn't respond with a valid response, Transmission ignores it; and that seems to be your case looking at the log.

Fixes: you can search for new firmware for your router, it may have fixed the invalid response, or not.

You can also make sure this is the problem by using miniupnp's tool, similar to the one you mentioned (UPnP PortMapper) this one is called upnpc, you can find it in the downloads of miniupnp's page, and if you can open (and close) the port then there is a workaround changing Transmission's code to disable the restriction on "valid response". Explanation: The upnpc program is more permissive than Transmission, it tries to open the port even when the router seems "buggy".

Another possibility is that the router uses a different standard in the UPnP communication, if this is the case you should open a case on miniupnp's forum so the author can see what your router does and add it to new versions.
kirin64
Posts: 4
Joined: Sat May 12, 2012 1:18 pm

Re: Transmission can't see UPnP on router

Post by kirin64 »

rb07 wrote: You can also make sure this is the problem by using miniupnp's tool, similar to the one you mentioned (UPnP PortMapper) this one is called upnpc, you can find it in the downloads of miniupnp's page, and if you can open (and close) the port then there is a workaround changing Transmission's code to disable the restriction on "valid response". Explanation: The upnpc program is more permissive than Transmission, it tries to open the port even when the router seems "buggy".

Another possibility is that the router uses a different standard in the UPnP communication, if this is the case you should open a case on miniupnp's forum so the author can see what your router does and add it to new versions.
Thanks for the pointer. I built miniupnpc, and it can successfully create and delete mappings:

Code: Select all


kirin@Gauss > ./upnpc-static -r 12000 TCP
upnpc : miniupnpc library test client. (c) 2006-2011 Thomas Bernard
Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
 desc: http://192.168.2.1:1780/InternetGatewayDevice.xml
 st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found a (not connected?) IGD : http://192.168.2.1:1780/control?WANIPConnection
Trying to continue anyway
Local LAN ip address : 192.168.2.8
ExternalIPAddress = 0.0.0.0
InternalIP:Port = 192.168.2.8:12000
external 0.0.0.0:12000 TCP is redirected to internal 192.168.2.8:12000 (duration=0)
I'm assuming the 'Found a (not connected?) IGD' bit is the problem for Transmission, and that the problem is that the router doesn't seem to report its WAN status (looking at the 'ExternalIPAddress = 0.0.0.0' bit, for one). I've opened a support ticket with Belkin, but who knows if that'll go anywhere. So you're suggesting that I could disable the check in Transmission's source? Or is there some kind of hidden preference?

Thanks for the advice. Nice to be getting somewhere; I've been banging my head against the metaphorical wall for a while now without getting anywhere.

Edit:

Discovered the status switch for miniupnpc, and it seems to confirm my suspicion:

Code: Select all

kirin@Gauss > ./upnpc-static -s
upnpc : miniupnpc library test client. (c) 2006-2011 Thomas Bernard
Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
 desc: http://192.168.2.1:1780/InternetGatewayDevice.xml
 st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found a (not connected?) IGD : http://192.168.2.1:1780/control?WANIPConnection
Trying to continue anyway
Local LAN ip address : 192.168.2.8
Connection Type : IP_Routed
Status : Disconnected, uptime=123224s, LastConnectionError : ERROR_NONE
  Time started : Sat May 12 12:49:41 2012
MaxBitRateDown : 0 bps   MaxBitRateUp 0 bps
ExternalIPAddress = 0.0.0.0
Bytes:   Sent: 145321713	Recv: 3508995191
Packets: Sent:  1404422	Recv:  2596500
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Transmission can't see UPnP on router

Post by rb07 »

Yep, that's the problem.
kirin64 wrote:So you're suggesting that I could disable the check in Transmission's source? Or is there some kind of hidden preference?
No hidden switch, you have to make a small change to Transmission's code, and build your Mac OS X application.

Code: Select all

Index: libtransmission/upnp.c
===================================================================
--- libtransmission/upnp.c      (revision 13295)
+++ libtransmission/upnp.c      (working copy)
@@ -195,7 +195,7 @@

         errno = 0;
         if( UPNP_GetValidIGD( devlist, &handle->urls, &handle->data,
-                             handle->lanaddr, sizeof( handle->lanaddr ) ) == UPNP_IGD_VALID_CONNECTED )
+                             handle->lanaddr, sizeof( handle->lanaddr ) ) )
         {
             tr_ninf( getKey( ), _(
                          "Found Internet Gateway Device \"%s\"" ),
In case you are wondering why Transmission is not more permissive in this case, there is an old ticket (for version 2.03) where the developer decided one way.
kirin64
Posts: 4
Joined: Sat May 12, 2012 1:18 pm

Re: Transmission can't see UPnP on router

Post by kirin64 »

Brilliant, thanks, I'll give it a go. Had a quick look for the ticket and couldn't find it, but I can certainly see the logic behind only trying to map ports on a connected gateway (I'm thinking networks with multiple possible gateways, etc). You'd think this was a fairly obvious thing to miss on Belkin's part, but I suppose it's too much to ask for more than cursory testing. :roll: They've informed me that they've 'escalated [the issue] to the research department', which sounds mightily impressive, but I'll not hold my breath.
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Transmission can't see UPnP on router

Post by rb07 »

Since there are several reports like yours, I think you should use the Mac forum (this is in the General forum, which is fine since it affects all the programs: daemon, transmission-gtk, transmission-qt, etc.) but in the Mac forum it has a better probability that Livings (the transmission-mac developer) will see it, and maybe even revert ticket #3452.
Post Reply