Comments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #140 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

allow unix domain sockets in nixio sendto and recvfrom

Reported by: reporter Owned by:
Priority: major Milestone: LuCI 0.10.0
Component: LuCI Base Keywords: unix socket recvfrom
Cc: bart.vandermeerssche@…

Description

Please find a patch in attachment that implements the AF_UNIX domain socket in the socket:sendto and socket:recvfrom functions. Especially the recvfrom is important when using the connectionless DGRAM sockets. For the server to be able to reply to an incoming request on a DGRAM socket, it needs to determine where the packet originated, in which case the recv or read methods will not do.

Remarks:
- Even with an unpatched io file, I did not manage to get the sendto to work properly with AF_INET domain sockets:

> print(s:sendto('test', '127.0.0.1', 8080))
nil	22	Invalid argument

- Linux itself apparently does not like the sendto to be used in conjunction with unix domain sockets (without being preceded by a connect, but then the sendto itself is quite useless):

> print(s:sendto('test', '/var/run/flukso/client.sock', 0))
nil	134	Transport endpoint is not connected

While this is clearly possible in HP-UX, see:  http://docs.hp.com/en/B2355-90136/ch07s06.html.

Best regards,
Bart Van Der Meerssche.

Attachments

110-allow_unix_socket_for_sendto_recvfrom.patch Download (2.8 KB) - added by reporter 3 years ago.
sento_fix_addr_len_add_unix_socket_support.patch Download (3.5 KB) - added by reporter 2 years ago.
Fix sendto() call. Add support for UNIX sockets from other patch.

Change History

Changed 3 years ago by reporter

Changed 2 years ago by reporter

Fix sendto() call. Add support for UNIX sockets from other patch.

Changed 2 years ago by reporter

The 'addrlen' parameter was not being set when an address was filled in, that is the source of the "Invalid argument" error. I also included the unix socket support in the "send_fix_addr_len_add_unix_socket_support.patch".

Changed 2 years ago by jow

  • status changed from new to closed
  • resolution set to fixed

Thanks you for your patches. I committed it in r6724 and it will be part of the upcoming LuCI 0.10.0 release.

Add/Change #140 (allow unix domain sockets in nixio sendto and recvfrom)

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.