[Nice] For some reason, my code doesn't actually communicate to my stun server...

Youness Alaoui youness.alaoui at collabora.co.uk
Mon Aug 23 13:12:07 PDT 2010


Yes, we got your previous messages, and I already answered about the issue.
The reason the unit tests don't work is that unit tests should work without
internet access, so they use the nice_agent_add_local_address to prevent any
connectivity checks with the external interfaces, so it forces libnice to use
the loopback device for testing. The sendto() fails because, I suppose, it can't
route the destination address on the loopback device.


On 08/23/2010 03:25 PM, Tony Di Croce wrote:
> 
> Also, I've noticed that none of the tests included with libnice are
> hitting my stun server as well...
> 
> I am setting NICE_STUN_SERVER and NICE_STUN_SERVER_PORT and I can echo
> those, and see they are correct... Further, I have utility "stunbdc"
> that is able to talk to my stun server...
> 
> Here's the relevant part of an strace I did:
> 
> socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 13
> fcntl64(13, F_GETFD)                    = 0
> fcntl64(13, F_SETFD, FD_CLOEXEC)        = 0
> fcntl64(13, F_GETFL)                    = 0x2 (flags O_RDWR)
> fcntl64(13, F_SETFL, O_RDWR|O_NONBLOCK) = 0
> bind(13, {sa_family=AF_INET, sin_port=htons(0),
> sin_addr=inet_addr("127.0.0.1")}, 16) = 0
> getsockname(13, {sa_family=AF_INET, sin_port=htons(56963),
> sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
> setsockopt(13, SOL_IP, IP_TOS, [0], 4)  = 0
> setsockopt(13, SOL_IPV6, 0x43 /* IPV6_??? */, [0], 4) = -1 ENOPROTOOPT
> (Protocol not available)
> mmap2(NULL, 143360, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> 0) = 0xb648f000
> socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 14
> fcntl64(14, F_GETFD)                    = 0
> fcntl64(14, F_SETFD, FD_CLOEXEC)        = 0
> fcntl64(14, F_GETFL)                    = 0x2 (flags O_RDWR)
> fcntl64(14, F_SETFL, O_RDWR|O_NONBLOCK) = 0
> bind(14, {sa_family=AF_INET, sin_port=htons(0),
> sin_addr=inet_addr("127.0.0.1")}, 16) = 0
> getsockname(14, {sa_family=AF_INET, sin_port=htons(36159),
> sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
> setsockopt(14, SOL_IP, IP_TOS, [0], 4)  = 0
> setsockopt(14, SOL_IPV6, 0x43 /* IPV6_??? */, [0], 4) = -1 ENOPROTOOPT
> (Protocol not available)
> mmap2(NULL, 143360, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> 0) = 0xb646c000
> open("/dev/urandom", O_RDONLY)          = 15
> fstat64(15, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
> ioctl(15, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbf9b37e0) = -1 EINVAL
> (Invalid argument)
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> 0) = 0xb78c4000
> read(15,
> ",\r\33\307\275\3659\205\233\267\24\231\210\362b\356&*\375Xs\236\251\10*\305\204!\300\3072;"...,
> 4096) = 4096
> close(15)                               = 0
> munmap(0xb78c4000, 4096)                = 0
> clock_gettime(CLOCK_MONOTONIC, {3880882, 819057133}) = 0
> sendto(13, "\0\1\0\0\221\314\250g\225\317\3\3362n^\r\3=6\210", 20, 0,
> {sa_family=AF_INET, sin_port=htons(3478),
> sin_addr=inet_addr("97.74.202.52")}, 16) = -1 EINVAL (Invalid argument)
> 
> Notice all the calls that are operating on file descriptor 13. It's
> returned at the top by a call to socket()... looks good... Eventually,
> setsockopt() with an IPV6 specific argument fails (don't know what that
> means)... but then at the bottom, a sendto() fails and sets errno to
> EINVAL.... Any ideas?
> 
>     td
> 
> 
> 
> _______________________________________________
> Nice mailing list
> Nice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nice


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/nice/attachments/20100823/f696bc8b/attachment.pgp>


More information about the Nice mailing list