-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/23/2014 05:40 PM, Iñaki Baz Castillo wrote:
> 2014-04-23 17:37 GMT+02:00 Iñaki Baz Castillo <[email protected]>:
>> 2014-04-23 17:22 GMT+02:00 Saúl Ibarra Corretgé
>> <[email protected]>:
>>> I don't think it's a bug, you are abusing the API :-) Now, I
>>> did spot something in the code which might explain it. The
>>> sockaddr struct is created on the stack, and my guess is that
>>> Linux is not populating it so you get whatever was there.
>>> 
>>> Please add a printf here: 
>>> https://github.com/joyent/libuv/blob/master/src/unix/udp.c#L228
>>> and print the content of h.msg_namelen. If my guess is correct
>>> you'll get 0 on Linux.
>> 
>> You are right. It is 0 in Linux, 16 in OSX.
>> 
>> The question is: why is it not populated by Linux??
> 
> BTW: the socket was generated with socketpair() so I understand
> that the field sockaddr_un->sun_path is an empty string (given that
> there was no bind for this socket). But the sun_family must be
> AF_UNIX.
> 
> 

My guess is that the field is not populated because your socket is
"connected" (because you use a socketpair), so there is no need to
tell you where the datagram was received from. Try this patch:
https://gist.github.com/saghul/11220483 which will give you NULL in
that case, instead of garbage.

- -- 
Saúl Ibarra Corretgé
bettercallsaghul.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQIcBAEBAgAGBQJTV9+JAAoJEEEOVVOum8BZeCYQAIuMzgI7oYM0VDAhomlnyCPK
Bs7UMovpkeclGAmDiHwrPRSmcCAfASDYk28smyRDLsnjVcjj9EUhfj0LbLVbNjZC
RWpZ1F2nHiFv7WdFnxp/bI5hR+/CSd3m4Sk3zuYj4+jYE7sB2ucCKhLQVNVQPBZd
+6oN8eLiJqkJH5NP5LniYclWRCA8U6nzWYgPs049wXlOCnHpD3e16Uu1lMyNqcOD
QNZiFarhQpDADDOvvUmguL6BhZhD4aQgAZ5HHhY89L5IRKk7zIWJybRgyJZ7ZEv2
v03Cs9FyutQTDpDg/WDUK5c6WVvsyK7Ak6kIQ/c4ronoJRRe/s5m0aoYB51UWF9V
z9VZOTWVerZFCvjzo2jXnYVxw5O9nxE8taqQmj3NyL5kdVYtisp8jdhK8OfNc6Bk
EZdRnI/uW1Z1K17EDPPJTpqFOWejNfIPIi6lYOZVjjp33Lfothxp/1kt3mhG02V/
O/OYW7VkEyDWyJDStCQhGyenss+9oD+5Rt5n+llEnKCticsalJshW7CF4OVmW5rH
HYcy0k8WwcfMuHvCKBGrbVPcR2XW/A/MTdEOvjZyn3FG/i5sVIxvmjKZdEVea5Je
/5AjG0mQdd+TD0bWWGKjNCvxo5wr2wcIzj6tVMZiDziGIl6HHkIIL0yFNGgsdFqb
KjEobcxN0PQlWC37/2Fj
=Oeg+
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to