summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/src/io.c
AgeCommit message (Collapse)Author
2011-12-16[PATCH] Abstract address UNIX sockets not binding properly (by ↵Jo-Philipp Wich
capnbry@gmail.com, #366) In #274, I stated abstract namespace and autobound abstract namespace datagram UNIX domain sockets work perfectly with nixio. However, I may have jumped the gun on that conclusion. Turns out they work perfectly for only one concurrent connection. The problem is that when binding to an abstract address socket, which begins with a NULL byte, nixio strncpy's the name into the sockaddr_un structure, which effectively copies nothing. It then binds to an address of 180 NULLs, which is completely legal, but obviously you run into problems when a second client tries to bind to the same address. The rules are as follows ( http://linux.die.net/man/7/unix) for the names: * If the name is blank, bind() should pass that the addrlen of sizeof(sa_family_t) and Linux will autobind a name that begins with null and is followed by 5 digits. * If the first character of the name is non-null, the name is a pathname and is null-terminated. addrlen should be sizeof(sockaddr_un), but the length can also be the pathname len + sizeof(sa_family_t) as the value will be null-terminated by the kernel unix socket driver * If the first character is null, the address is abstract and the value should not be null-terminated and addrlen is pathname + sizeof(sa_family_t) The attached patch fixes bind/connect/sendto by shortening the addrlen passed to be pathname len + sizeof(sa_family_t), which generates the correct socket names for all 3 cases above. It also fixes the address returned by recvfrom, which currently returns a blank string for any abstract address socket (as they begin with a null).
2011-07-17libs/nixio: Fix recvfrom() return values for unnamed unix sockets, patch by ↵Jo-Philipp Wich
capnbry@gmail.com (#274)
2011-01-13libs/nixio: fix sendto(), implement support for unix domain sockets (#140)Jo-Philipp Wich
2009-10-26nixio: store stats and other number information as integer, which works ↵Felix Fietkau
better when lua number support is downgraded from double to float
2009-04-21Merge nixio 0.2Steven Barth
2009-03-12nixio: FreeBSD compatibility #2Steven Barth
2009-02-27nixio: Fixes, use POSIX calls for file i/oSteven Barth
httpclient: resume support, splice() support, cookie support
2009-02-22NIXIO: TLS-Support, bugfixesSteven Barth
2009-02-12nixio nextSteven Barth
splice() still does not work correctly
2009-02-10nixio + io = nix2ioSteven Barth