luci/libs
Jo-Philipp Wich ca7bc48ebc [PATCH] Abstract address UNIX sockets not binding properly (by 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-12-16 02:10:37 +00:00
..
core libs/core: fix undefined tostring() in network model 2011-12-05 19:36:50 +00:00
fastindex * Rewrote Luci to be coroutine-safe allowing the use of non-forking webservers 2008-06-14 14:12:12 +00:00
httpclient libs/httpclient: return server response line in error case (#249) 2011-06-25 22:57:18 +00:00
ipkg libs/ipkg: give caller more control over filter pattern 2011-10-15 03:10:19 +00:00
json libs/json: Fix a typo and a logic error in json.lua to make luci.json.encode() work like expected (#220) 2011-04-17 11:39:17 +00:00
lmo libs/lmo: skip all entries with identical key and value when generating lmo archives 2011-01-02 18:16:54 +00:00
lucid libs/lucid: fix process function leak (#285) 2011-08-11 23:23:11 +00:00
lucid-http libs/lucid-http: fix regressions with recent git uci 2009-12-29 17:50:35 +00:00
lucid-rpc GSoC: Documentation #2 2009-06-14 08:51:43 +00:00
nixio [PATCH] Abstract address UNIX sockets not binding properly (by capnbry@gmail.com, #366) 2011-12-16 02:10:37 +00:00
px5g libs/px5g: fix compilation on OpenWrt trunk 2010-11-16 16:30:07 +00:00
rpcc GSoC: Add RPC client 2009-06-14 09:02:40 +00:00
sgi-cgi Add possibility to show execution time in the footer 2010-11-23 01:02:21 +00:00
sgi-luci Make LuCIttpd work OOTB 2008-12-07 11:47:59 +00:00
sgi-uhttpd libs/sgi-uhttpd: move exectime inside handle_request 2010-12-15 01:04:38 +00:00
sgi-wsapi Made SGIs even more standards compliant (respect EOF command from LuCI) 2008-07-23 18:52:12 +00:00
sys From c63e369d57cb6862a8890c7b2ee1b6b449b2c42d Mon Sep 17 00:00:00 2001 2011-12-05 16:38:54 +00:00
web libs/web: add missing parts of previous commit 2011-12-16 01:18:34 +00:00