miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

errors with port mapping

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> libnatpmp Bugs
View previous topic :: View next topic  
Author Message
livings124



Joined: 08 Dec 2007
Posts: 10

PostPosted: Sat Dec 08, 2007 8:40 pm    Post subject: errors with port mapping Reply with quote

Hey, I'm the other developer from Transmission. With the recent inclusion I've been getting these two errors logged.

12/8/07 3:38:20 PM [0x0-0x82c82c][50004] Port Mapping (NAT-PMP): initnatpmp returned error -3, errno is 22 (Invalid argument)

12/8/07 3:38:20 PM [0x0-0x82c82c][50004] Port Mapping (NAT-PMP): sendpublicaddressrequest returned error -10, errno is 39 (Destination address required)
Back to top
View user's profile Send private message
Charles



Joined: 06 Nov 2007
Posts: 20

PostPosted: Sat Dec 08, 2007 9:07 pm    Post subject: Reply with quote

if it's helpful to you, Transmission's wrapper code for natpmp can be found at http://transmission.m0k.org/trac/browser/trunk/libtransmission/natpmp.c
Back to top
View user's profile Send private message
Chinstrap



Joined: 08 Dec 2007
Posts: 6

PostPosted: Sat Dec 08, 2007 9:13 pm    Post subject: Reply with quote

Hey, I'm nobody, I just pester the Transmission developers. Since gcc on OSX doesn't define BSD, we aren't getting a working implementation of getgateway. I just added the check for __APPLE__ and that seemed to fix it.

---getgateway.c
+++getgateway.c
@@ -17,7 +17,7 @@
#include <ctype.h>
#include <netinet/in.h>
#include <sys/param.h>
-#ifdef BSD
+#if defined(BSD) || defined(__APPLE__)
#include <stdlib.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
@@ -60,7 +60,7 @@
}
#endif

-#ifdef BSD
+#if defined(BSD) || defined(__APPLE__)

#define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Dec 11, 2007 12:47 am    Post subject: Reply with quote

thanks for the patch Smile
indeed -3 is the value for NATPMP_ERR_CANNOTGETGATEWAY
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Charles



Joined: 06 Nov 2007
Posts: 20

PostPosted: Tue Dec 11, 2007 5:38 am    Post subject: Reply with quote

miniupnp wrote:
thanks for the patch Smile
indeed -3 is the value for NATPMP_ERR_CANNOTGETGATEWAY

The patch gets things building, but doesn't solve the error. Is there anything you need from the Transmission team, or from Apple testers, to get this working?
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Dec 11, 2007 9:15 am    Post subject: Reply with quote

Charles wrote:
miniupnp wrote:
thanks for the patch Smile
indeed -3 is the value for NATPMP_ERR_CANNOTGETGATEWAY

The patch gets things building, but doesn't solve the error. Is there anything you need from the Transmission team, or from Apple testers, to get this working?

Does the test program testgetgateway build and work ?
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Charles



Joined: 06 Nov 2007
Posts: 20

PostPosted: Tue Dec 11, 2007 3:14 pm    Post subject: Reply with quote

miniupnp wrote:
Charles wrote:
miniupnp wrote:
thanks for the patch Smile
indeed -3 is the value for NATPMP_ERR_CANNOTGETGATEWAY

The patch gets things building, but doesn't solve the error. Is there anything you need from the Transmission team, or from Apple testers, to get this working?

Does the test program testgetgateway build and work ?


I don't have a mac so I'm just a messenger here, but here are the results from a mac Airport user:

Quote:
07:03 <@charles_> This is to test the libnatpmp library on a mac
07:03 <@charles_> background information is here: http://miniupnp.tuxfamily.org/forum/viewtopic.php?t=417
07:03 <@charles_> but short summary: download http://miniupnp.free.fr/files/download.php?file=libnatpmp-20071202.tar.gz
07:04 <@charles_> build it (it's very small -- just a couple of files)
07:04 <@charles_> then run "testgetgateway" and report back the results
07:05 < Lfe> failed
07:05 < Lfe> full info: getdefaultgateway() failed
07:06 <@charles_> *nod*
07:07 <@charles_> I'll let them know... thanks for the test
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Wed Dec 12, 2007 3:54 pm    Post subject: Reply with quote

i'm going to put some specific code for getgateway under Mac OS X
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Chinstrap



Joined: 08 Dec 2007
Posts: 6

PostPosted: Wed Dec 12, 2007 9:36 pm    Post subject: Reply with quote

If you want to take a look at http://transmission.m0k.org/trac/browser/branches/0.9x/libtransmission/platform.c

tr_getDefaultRoute() is what we use in Transmission to get the default route. The BSD section works for both BSD and OSX. In fact, I went so far as to take a copy of libnatpmp-20071202 and replace getgateway.c with the getDefaultRoute and supporting functions from platform.c and built and ran the test programs under OSX successfully.
Back to top
View user's profile Send private message
Charles



Joined: 06 Nov 2007
Posts: 20

PostPosted: Thu Dec 13, 2007 2:08 am    Post subject: Reply with quote

Chinstrap and I worked on this a bit today and merged Transmission's old mac gateway code with your Linux gateway code, which is much cleaner than ours. Wink

The result is here in Transmission's svn. This merged version of getgateway() is confirmed to work on Linux and OS X and has the same license as libnatpmp, if you want it.
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Dec 13, 2007 2:25 pm    Post subject: Reply with quote

Charles wrote:
Chinstrap and I worked on this a bit today and merged Transmission's old mac gateway code with your Linux gateway code, which is much cleaner than ours. Wink

The result is here in Transmission's svn. This merged version of getgateway() is confirmed to work on Linux and OS X and has the same license as libnatpmp, if you want it.

thanks !
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Dec 13, 2007 5:02 pm    Post subject: Reply with quote

I have just corrected the mib[] array content Smile
it should work now Wink
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> libnatpmp Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.