LuCI - OpenWrt Configuration Interface
Find a file
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
applications applications/luci-firewall: allow negated uci identifiers, hostnames and ip addresses in zone masq src/dest fields 2011-12-16 01:25:07 +00:00
build build: i18n-scan.pl: cope with strings that contain escaped newlines, spotted in luci-pbx 2011-11-05 18:35:54 +00:00
contrib contrib/package: make luci-app-statistics depend on collectd-mod-iwinfo 2011-12-09 18:06:38 +00:00
i18n i18n, contrib: package ukrainian language support 2011-11-30 15:10:55 +00:00
libs [PATCH] Abstract address UNIX sockets not binding properly (by capnbry@gmail.com, #366) 2011-12-16 02:10:37 +00:00
modules modules/admin-full: probe for EAP support in wpad/hostapd/wpa_supplicant and offer wpa/wpa2 only if it is present 2011-12-13 15:57:32 +00:00
po Commit from LuCI Translation Portal by user jow.: 60 of 108 messages translated (0 fuzzy). 2011-12-14 15:59:26 +00:00
protocols protocols/core: change vendorclass option to vendorid to match actual OpenWrt implementation 2011-12-08 16:52:45 +00:00
themes themes/openwrt: small css fix for tab menu rendering in webkit 2011-10-27 17:15:00 +00:00
.buildpath * new project: ff-luci - Freifunk Lua Configuration Interface 2008-03-02 21:52:58 +00:00
.cproject More C-Functions (luci.cutil.instanceof, luci.cutil.pcdata) 2008-11-20 19:22:05 +00:00
.gitignore Added "apidocs" target to Makefile 2008-07-29 21:16:12 +00:00
.project LuCI Core C-Rewrite: First steps 2008-11-19 23:02:36 +00:00
INSTALL HTTP is sufficient for plain checkouts, Schäuble could also do checkouts before by himself 2009-01-02 21:42:49 +00:00
LICENSE * new project: ff-luci - Freifunk Lua Configuration Interface 2008-03-02 21:52:58 +00:00
Makefile build: add nixiodocs make target, remove uvldocs target 2011-02-16 20:14:25 +00:00
NOTICE Add axTLS sourcecode 2009-02-22 23:19:25 +00:00
THANKYOU * luci: replace all "OpenWRT" occurences with "OpenWrt" 2008-10-27 15:19:58 +00:00