Displaying 14 results from an estimated 14 matches for "connaddrlen".
2019 May 28
1
[libnbd PATCH] connect: Better handling of long socket names
...n > sizeof sun.sun_path) {
+ set_error (ENAMETOOLONG, "socket name too long: %s", h->unixsocket);
+ SET_NEXT_STATE (%.DEAD);
+ return -1;
+ }
+ memcpy (sun.sun_path, h->unixsocket, socklen);
+ len = sizeof sun;
memcpy (&h->connaddr, &sun, len);
h->connaddrlen = len;
--
2.20.1
2023 Mar 23
1
[libnbd PATCH v3 07/19] socket activation: replace execvp() call with fork-safe variant
...->argv, env.ptr);
nbd_internal_fork_safe_perror (h->argv.ptr[0]);
if (errno == ENOENT)
_exit (127);
else
_exit (126);
}
/* Parent -- we're done; commit. */
h->sact_tmpdir = tmpdir;
h->sact_sockpath = sockpath;
h->pid = pid;
h->connaddrlen = sizeof addr;
memcpy (&h->connaddr, &addr, h->connaddrlen);
next = %^CONNECT.START;
/* fall through, for releasing the temporaries */
empty_env:
string_vector_empty (&env);
+uninit_execvpe:
+ nbd_internal_execvpe_uninit (&execvpe_ctx);
+
unlink_sockpath:...
2019 Oct 01
2
Re: [PATCH libnbd v2 2/2] api: Implement local command with systemd socket activation.
...t; + nbd_internal_fork_safe_perror (h->argv[0]);
> + if (errno == ENOENT)
> + _exit (127);
> + else
> + _exit (126);
> + }
> +
> + /* Parent. */
> + close (s);
> + nbd_internal_free_string_list (env);
> + h->pid = pid;
> +
> + h->connaddrlen = sizeof addr;
> + memcpy (&h->connaddr, &addr, h->connaddrlen);
> + SET_NEXT_STATE (%^CONNECT.START);
> + return 0;
> +
> +#else /* !HAVE_EXECVPE */
> + SET_NEXT_STATE (%.DEAD)
> + set_error (ENOTSUP, "platform does not support socket activation");...
2019 Nov 15
1
Re: [PATCH libnbd v2 2/2] api: Implement local command with systemd socket activation.
...);
- execvpe (h->argv[0], h->argv, env);
+ environ = env;
+ execvp (h->argv[0], h->argv);
nbd_internal_fork_safe_perror (h->argv[0]);
if (errno == ENOENT)
_exit (127);
@@ -217,11 +218,4 @@ STATE_MACHINE {
memcpy (&h->connaddr, &addr, h->connaddrlen);
SET_NEXT_STATE (%^CONNECT.START);
return 0;
-
-#else /* !HAVE_EXECVPE */
- SET_NEXT_STATE (%.DEAD);
- set_error (ENOTSUP, "platform does not support socket activation");
- return 0;
-#endif
-
} /* END STATE MACHINE */
--
2.21.0
--
Eric Blake, Principal Software Enginee...
2019 Sep 26
5
[PATCH libnbd 1/2] lib: Avoid killing subprocess twice.
If the user calls nbd_kill_subprocess, we shouldn't kill the process
again when we close the handle (since the process has likely gone and
we might be killing a different process).
---
lib/handle.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/handle.c b/lib/handle.c
index 2af25fe..5ad818e 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -315,6 +315,8 @@
2019 Sep 30
4
[PATCH libnbd v2 0/2] Implement systemd socket activation.
v1 was posted here:
https://www.redhat.com/archives/libguestfs/2019-September/thread.html#00337
v2:
- Drop the first patch.
- Hopefully fix the multiple issues with fork-safety and general
behaviour on error paths.
Note this requires execvpe for which there seems to be no equivalent
on FreeBSD, except some kind of tedious path parsing (but can we
assign to environ?)
Rich.
2019 Sep 26
0
[PATCH libnbd 2/2] api: Implement local command with systemd socket activation.
...setenv ("LISTEN_FDS", "1", 1);
+
+ /* Restore SIGPIPE back to SIG_DFL. */
+ signal (SIGPIPE, SIG_DFL);
+
+ execvp (h->argv[0], h->argv);
+ perror (h->argv[0]);
+ _exit (EXIT_FAILURE);
+ }
+
+ /* Parent. */
+ close (s);
+ h->pid = pid;
+
+ h->connaddrlen = sizeof addr;
+ memcpy (&h->connaddr, &addr, h->connaddrlen);
+ SET_NEXT_STATE (%^CONNECT.START);
+ return 0;
+
} /* END STATE MACHINE */
diff --git a/interop/Makefile.am b/interop/Makefile.am
index 43350a8..d30cdf1 100644
--- a/interop/Makefile.am
+++ b/interop/Makefile.am
@@ -4...
2019 Sep 30
0
[PATCH libnbd v2 2/2] api: Implement local command with systemd socket activation.
...PE, SIG_DFL);
+
+ execvpe (h->argv[0], h->argv, env);
+ nbd_internal_fork_safe_perror (h->argv[0]);
+ if (errno == ENOENT)
+ _exit (127);
+ else
+ _exit (126);
+ }
+
+ /* Parent. */
+ close (s);
+ nbd_internal_free_string_list (env);
+ h->pid = pid;
+
+ h->connaddrlen = sizeof addr;
+ memcpy (&h->connaddr, &addr, h->connaddrlen);
+ SET_NEXT_STATE (%^CONNECT.START);
+ return 0;
+
+#else /* !HAVE_EXECVPE */
+ SET_NEXT_STATE (%.DEAD)
+ set_error (ENOTSUP, "platform does not support socket activation");
+ return 0;
+#endif
+
+} /* END S...
2019 Sep 26
2
Re: [PATCH libnbd 2/2] api: Implement local command with systemd socket activation.
...t; + _exit (EXIT_FAILURE);
Is EXIT_FAILURE the best here, or should we consider exiting with status
126/127 to match what other programs (sh, env, nice, nohup, ...) do when
execvp() fails?
> + }
> +
> + /* Parent. */
> + close (s);
> + h->pid = pid;
> +
> + h->connaddrlen = sizeof addr;
> + memcpy (&h->connaddr, &addr, h->connaddrlen);
> + SET_NEXT_STATE (%^CONNECT.START);
> + return 0;
> +
> } /* END STATE MACHINE */
> +++ b/interop/socket-activation.c
> +#define SIZE 1048576
> +
> +int
> +main (int argc, char *arg...
2023 Mar 23
20
[libnbd PATCH v3 00/19] pass LISTEN_FDNAMES with systemd socket activation
V3 was here:
<http://mid.mail-archive.com/20230215141158.2426855-1-lersek at redhat.com>.
See the Notes section on each patch for the v4 updates.
The series is nearly ready for merging: every patch has at least one R-b
tag, except "socket activation: avoid manipulating the sign bit".
The series builds, and passes "make check" and "make check-valgrind", at
2019 Oct 18
0
[PATCH libnbd 2/2] api: Add support for AF_VSOCK.
...(%^CONNECT.START);
return 0;
+ CONNECT_VSOCK.START:
+#ifdef AF_VSOCK
+ struct sockaddr_vm svm = {
+ .svm_family = AF_VSOCK,
+ .svm_cid = h->svm_cid,
+ .svm_port = h->svm_port,
+ };
+ const socklen_t len = sizeof svm;
+
+ memcpy (&h->connaddr, &svm, len);
+ h->connaddrlen = len;
+ SET_NEXT_STATE (%^CONNECT.START);
+ return 0;
+#else
+ set_error (ENOTSUP, "AF_VSOCK protocol is not supported");
+ SET_NEXT_STATE (%.DEAD);
+#endif
+
CONNECT_TCP.START:
int r;
diff --git a/lib/connect.c b/lib/connect.c
index a0ef5f1..d8bb121 100644
--- a/lib/connect.c...
2019 Oct 18
5
[PATCH libnbd 0/2] api: Add support for AF_VSOCK.
This is a series of patches to libnbd and nbdkit adding AF_VSOCK
support.
On the host side it allows you to start an nbdkit instance which
listens on a virtio-vsock socket:
$ ./nbdkit -fv --vsock memory 1G
...
nbdkit: debug: bound to vsock 2:10809
On the guest side you can then use libnbd to connect to the server:
$ ./run nbdsh -c 'h.connect_vsock(2, 10809)' -c
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples
have been updated, but it demonstrates an idea: Should we forget about
the concept of having multiple connections managed under a single
handle?
In this patch there is a single ‘struct nbd_handle *’ which manages a
single state machine and connection (and therefore no nbd_connection).
To connect to a multi-conn server you must
2019 May 22
12
[libnbd PATCH v3 0/7] Avoid deadlock with in-flight commands
Since v2:
- rebase to Rich's new API calls
- more refactoring in patch 1 (retitled)
- new patches 3 and 4
- fix data corruption in patch 6 (was 4)
- more tweaks to the reproducer example (including using new API from 3)
Eric Blake (7):
lib: Refactor command_common() to do more common work
commands: Allow for a command queue
commands: Expose FIFO ordering of server completions