On Tue, Nov 28, 2006 at 12:45:19PM +0200, Pekka Pessi wrote:
> On 11/27/06, Konstantin Belousov <[EMAIL PROTECTED]> wrote:
> >I tried to use stunc stun client on freebsd (6.2-PRERELEASE), and
> >systematically got errno == EINVAL from the call su_sendto() at the
> >stun_common.c:619 (with the latest darcs sources). The problem seems to
> >be the last argument to sendto(), that is the sizeof(su_sockaddr_t),
> >that is 0x20 on freebsd6/i386. The kernel expects it to be equal to the
> >sizeof(struct sockaddr_af) for correspoding address family af. The patch
> >below fixed it to me, at least for AF_INET.
> 
> Thanks for reporting the bug. The len field is not really present in
> the sockaddr structures of most systems, including Linux, Solaris and
> winsock, so you have to calculate the correct size based on the
> address family (su_family) field. There is a macro SU_SOCKADDR_SIZE()
> for that purpose.
> 
> I pushed a patch using SU_SOCKADDR_SIZE() to darcs.

Thanks for fixing (in the right way).

Now, another problem, on win32 now. In libsofia-sip-ua/stun/stun.c, line 822,
call to getsockname() fails because socket is not bound. As stated
in win32 documentation, WSAGetLastError() returns WSAEINVAL. Commenting out
the if (err < 0) block allows the stunc to operate on windows 2003 SP1.
I hope you would fix it before 1.12.4.

--- old-sofia-sip-win/libsofia-sip-ua/stun/stun.c       2006-11-28 
13:42:34.299109703 +0200
+++ new-sofia-sip-win/libsofia-sip-ua/stun/stun.c       2006-11-28 
13:42:34.303237352 +0200
@@ -820,11 +820,11 @@
   memset(sa, 0, bind_len);
   /* if bound check the error */
   err = getsockname(s, (struct sockaddr *) sa, &bind_len);
-  if (err < 0) {
+/*  if (err < 0) {
     STUN_ERROR(errno, getsockname);
     return -1;
   }
-
+*/
   /* Not bound - bind it */
   if (sa->su_port == 0) {
 #if defined (__CYGWIN__)

Attachment: pgpdElllNsXG4.pgp
Description: PGP signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to