Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ increased the applications' startup timeout.
</para>
</change>

<change type="change">
<para>
disallowed abstract Unix domain socket syntax in non-Linux systems.
</para>
</change>

<change type="feature">
<para>
supporting abstract UNIX sockets.
</para>
</change>

<change type="feature">
<para>
supporting UNIX sockets in address matching.
Expand Down
7 changes: 6 additions & 1 deletion src/nxt_conf_validation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1480,9 +1480,14 @@ nxt_conf_vldt_listener(nxt_conf_validation_t *vldt, nxt_str_t *name,
nxt_conf_value_t *value)
{
nxt_int_t ret;
nxt_str_t str;
nxt_sockaddr_t *sa;

sa = nxt_sockaddr_parse(vldt->pool, name);
if (nxt_slow_path(nxt_str_dup(vldt->pool, &str, name) == NULL)) {
return NXT_ERROR;
}

sa = nxt_sockaddr_parse(vldt->pool, &str);
if (nxt_slow_path(sa == NULL)) {
return nxt_conf_vldt_error(vldt,
"The listener address \"%V\" is invalid.",
Expand Down
4 changes: 3 additions & 1 deletion src/nxt_main_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,9 @@ nxt_main_listening_socket(nxt_sockaddr_t *sa, nxt_listening_socket_t *ls)

#if (NXT_HAVE_UNIX_DOMAIN)

if (sa->u.sockaddr.sa_family == AF_UNIX) {
if (sa->u.sockaddr.sa_family == AF_UNIX
&& sa->u.sockaddr_un.sun_path[0] != '\0')
{
char *filename;
mode_t access;

Expand Down
14 changes: 9 additions & 5 deletions src/nxt_sockaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,6 @@ nxt_sockaddr_unix_parse(nxt_mp_t *mp, nxt_str_t *addr)

socklen = offsetof(struct sockaddr_un, sun_path) + length + 1;

#if (NXT_LINUX)

/*
* Linux unix(7):
*
Expand All @@ -612,12 +610,18 @@ nxt_sockaddr_unix_parse(nxt_mp_t *mp, nxt_str_t *addr)
* are covered by the specified length of the address structure.
* (Null bytes in the name have no special significance.)
*/
if (path[0] == '@') {
switch (path[0]) {
case '@':
path[0] = '\0';
/* fall through */
case '\0':
socklen--;
}

#if !(NXT_LINUX)
nxt_thread_log_error(NXT_LOG_ERR,
"abstract unix domain sockets are not supported");
return NULL;
#endif
}

sa = nxt_sockaddr_alloc(mp, socklen, addr->length);

Expand Down