summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_listen_socket.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-06-18Use octal instead of mode macrosAlejandro Colomar1-1/+1
They are more readable. And we had a mix of both styles; there wasn't really a consistent style. Tested-by: Andrew Clayton <a.clayton@nginx.com> Reviewed-by: Andrew Clayton <a.clayton@nginx.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-19Allow to set the permissions of the Unix domain control socketAndrew Clayton1-2/+12
Several users in GitHub have asked for the ability to set the permissions of the unitd UNIX Domain control socket. This can of course be done externally, but can be done much cleaner by Unit itself. This commit adds three new options --control-mode Set the mode of the socket, e.g 644 --control-user Set the user/owner of the socket, e.g unit --control-group Set the group of the socket, e.g unit Of course these only have an affect when using a UNIX Domain Socket for the control socket. Requested-by: michaelkosir <https://github.com/michaelkosir> Requested-by: chopanovv <https://github.com/chopanovv> Link: <https://github.com/nginx/unit/issues/254> Link: <https://github.com/nginx/unit/issues/980> Closes: https://github.com/nginx/unit/issues/840 Tested-by: Liam Crilly <liam.crilly@nginx.com> Reviewed-by: Zhidao Hong <z.hong@f5.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2023-03-17Improve an error message regarding Unix domain sockets.Andrew Clayton1-1/+1
When starting unit, if its Unix domain control socket was already active you would get an error message like 2023/03/15 18:07:55 [alert] 53875#8669650 connect(5, unix:/tmp/control.sock) succeed, address already in use which is confusing in a couple of regards, firstly we have the classic success/failure message and secondly 'address already in use' is an actual errno value, EADDRINUSE and we didn't get an error from this connect(2). Re-word this error message for greater clarity. Reported-by: Liam Crilly <liam.crilly@nginx.com> Cc: Liam Crilly <liam.crilly@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2020-04-08Controller: improved handling of unix domain control socket.Valentin Bartenev1-11/+86
One of the ways to detect Unit's startup and subsequent readiness to accept commands relies on waiting for the control socket file to be created. Earlier, it was unreliable due to a race condition between the client's connect() and the daemon's listen() calls after the socket's bind() call. Now, unix domain listening sockets are created with a nxt_listen_socket_create() call as follows: s = socket(); unlink("path/to/socket.tmp") bind(s, "path/to/socket.tmp"); listen(s); rename("path/to/socket.tmp", "path/to/socket"); This eliminates a time-lapse when the socket file is already created but nobody is listening on it yet, which therefore prevents the condition described above. Also, it allows reliably detecting whether the socket is being used or simply wasn't cleaned after the daemon stopped abruptly. A successful connection to the socket file means the daemon has been started; otherwise, the file can be overwritten.
2020-04-08Controller: fixed cleaning up of control socket file in some cases.Valentin Bartenev1-6/+20
Previously, the unix domain control socket file might have been left in the file system after a failed nxt_listen_socket_create() call.
2020-04-08Removed unused code related to testing of address binding.Valentin Bartenev1-15/+2
2018-09-20Added SSL/TLS support on connection level.Igor Sysoev1-4/+4
2018-06-25Introduced nxt_length() macro.Valentin Bartenev1-5/+5
2018-03-05Reduced number of critical log levels.Valentin Bartenev1-6/+5
2018-01-24Fixed formatting in nxt_sprintf() and logging.Sergey Kandaurov1-1/+1
2018-01-24Using size_t for the field width type of the "%*s" specifier.Sergey Kandaurov1-1/+1
2017-10-18Router: fixed segfault after configuration change.Igor Sysoev1-2/+2
2017-09-14Fixed textual socket name lengths and Unix domain sockaddr length.Igor Sysoev1-0/+41
2017-08-26Added configure and command line option --control.Igor Sysoev1-1/+1
2017-08-26Introduced nxt_socket_defer_accept().Igor Sysoev1-7/+1
2017-08-26Removed unused function.Igor Sysoev1-68/+0
2017-08-16Corrected path to nxt_socket.h in comments.Ruslan Ermilov1-1/+1
2017-07-05Router: processing JSON configuration.Igor Sysoev1-0/+84
2017-06-20Using new memory pool implementation.Igor Sysoev1-1/+1
2017-06-14nxt_event_conn_... functions and structures have been renamedIgor Sysoev1-1/+1
to nxt_conn_...
2017-02-22I/O operations refactoring.Igor Sysoev1-16/+22
2017-01-17Initial version.Igor Sysoev1-0/+252