| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I found myself running
vsockclient 2 1024 true
in a situation where it just mattered that a connection was made, and
no data needed to be exchanged of it. That I found myself doing this
is quite a strong indicator that the program to exec into should be
optional.
UCSPI-1996[1] doesn't specify what should happen if no application is
provided, so I think this is a reasonable interpretation. I'm not
sure if I feel the same for vsockserver(d), so I haven't made the
corresponding change there. I'll wait to see if there's ever a need
for it.
[1]: https://cr.yp.to/proto/ucspi.txt
Message-Id: <20210324182433.19110-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
| |
Message-Id: <20210324135022.15874-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
But we preserve the autoconf behaviour of only warning on invalid
options.
$ ./configure --test
Warning: unrecognized options: --test
$ ./configure test
Error: unexpected argument: test
Message-Id: <20210321193951.21671-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
| |
Message-ID: <20210321193902.21087-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Identified by clang-tidy:
vsockserver.c:105:17: warning: 3rd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
while ((opt = argz_next(binder_opts, binder_opts_len, opt)))
^
vsockserver.c:44:3: note: Assuming the condition is false
argz_add(&binder_opts, &binder_opts_len, BINDIR "/vsockserver-socketbinder") ||
^
vsockserver.c:44:3: note: Left side of '||' is false
vsockserver.c:47:9: note: Assuming the condition is false
while ((opt = getopt(argc, argv, "+1qQv")) != -1) {
^
vsockserver.c:47:2: note: Loop condition is false. Execution continues on line 68
while ((opt = getopt(argc, argv, "+1qQv")) != -1) {
^
vsockserver.c:68:6: note: Assuming 'alloc_failed' is false
if (alloc_failed)
^
vsockserver.c:68:2: note: Taking false branch
if (alloc_failed)
^
vsockserver.c:77:6: note: Assuming the condition is false
if (optind > argc - 3)
^
vsockserver.c:77:2: note: Taking false branch
if (optind > argc - 3)
^
vsockserver.c:81:6: note: Assuming the condition is false
if (argz_add(&binder_opts, &binder_opts_len, "--") ||
^
vsockserver.c:81:6: note: Left side of '||' is false
vsockserver.c:82:6: note: Assuming the condition is false
argz_add(&binder_opts, &binder_opts_len, argv[optind++]) ||
^
vsockserver.c:81:6: note: Left side of '||' is false
if (argz_add(&binder_opts, &binder_opts_len, "--") ||
^
vsockserver.c:83:6: note: Assuming the condition is false
argz_add(&binder_opts, &binder_opts_len, argv[optind++]))
^
vsockserver.c:81:2: note: Taking false branch
if (argz_add(&binder_opts, &binder_opts_len, "--") ||
^
vsockserver.c:89:6: note: Assuming the condition is false
if (argz_append(&binder_opts, &binder_opts_len, daemon_opts, daemon_opts_len))
^
vsockserver.c:89:2: note: Taking false branch
if (argz_append(&binder_opts, &binder_opts_len, daemon_opts, daemon_opts_len))
^
vsockserver.c:96:23: note: Assuming 'i' is >= 'argc'
for (int i = optind; i < argc; i++)
^
vsockserver.c:96:2: note: Loop condition is false. Execution continues on line 100
for (int i = optind; i < argc; i++)
^
vsockserver.c:100:6: note: Assuming 'verbosity' is equal to all
if (verbosity == all) {
^
vsockserver.c:100:2: note: Taking true branch
if (verbosity == all) {
^
vsockserver.c:101:3: note: 'opt' declared without an initial value
char *opt;
^
vsockserver.c:105:17: note: 3rd function call argument is an uninitialized value
while ((opt = argz_next(binder_opts, binder_opts_len, opt)))
Message-Id: <20210321145440.28563-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Identified by clang-tidy:
exec.c:21:2: warning: Potential leak of memory pointed to by 'argv' [clang-analyzer-unix.Malloc]
return execvp(file, argv);
^
exec.c:15:16: note: Memory is allocated
char **argv = calloc(argz_count(argz, len) + 1, sizeof(char *));
^
exec.c:16:6: note: Assuming 'argv' is non-null
if (!argv)
^
exec.c:16:2: note: Taking false branch
if (!argv)
^
exec.c:21:2: note: Potential leak of memory pointed to by 'argv'
return execvp(file, argv);
Message-Id: <20210321145118.27783-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
vsockserver-socketbinder creates and listens on a socket, and
vsockserverd accepts connections and sets up file descriptors.
vsockserver previously did both of these things in one big program,
but now it just sets up a command line to run vsockserver-socketbinder
followed by vsockserverd. Having two seperate programs allows one
program to be used in situations where the other is not
suitable (e.g. using vsockserver-socketbinder to create a socket in
situations where accept behaviour more complex than vsockserverd can
provide is required).
This design is taken from s6[1], which uses the same design for its
s6-ipcserver, s6-ipcserver-socketbinder, and s6-ipcserverd programs.
[1]: https://skarnet.org/software/s6/
Message-Id: <20210319031713.23600-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
| |
Message-Id: <20210319025648.17925-6-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
| |
This is useful if we want to provide a more specific error message
than strerror can provide.
Message-Id: <20210319025648.17925-5-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
| |
This will allow programs to refer to BINDIR to find other ucspi-vsock
programs, which allows programs to be implemented in terms of each
other.
Message-Id: <20210319025648.17925-4-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is entirely an implementation detail, for the moment, but it
becomes important when we split out vsockserver into two seperate
programs, one for binding the socket, and one for accepting, like
s6-networking. Non-blocking sockets are the default there, so it
makes sense to share that behaviour.
I added the comment about blockingness of the connection sockets just
in case, but for now Linux is the only Unix with an AF_VSOCK
implementation, so I don't expect it to become relevant any time soon.
Message-Id: <20210319025648.17925-3-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
| |
Extracting a helper function for this has the nice side effect of
making the `cid' and `port' parameters to vsock_accept nullable, which
is nice for consistency with vsock_get_cid_and_port.
Message-Id: <20210319025648.17925-2-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
| |
We can get both in the same system call, so we might as well, rather
than having two different functions that make the system call twice.
Message-Id: <20210319025648.17925-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
| |
This is, unfortunately, the only "internal macro" POSIX requires to be
available for target rules, and I do want to keep the Makefile
POSIX-compatible. But this is at least a slight improvement.
Message-Id: <20210318190451.15182-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
| |
Using a wildcard with rm -f means that if there are no object files to
remove, rm will try to remove a non-existent file named '*.o', and
then ignore the failure it gets by trying to do that. Which is fine.
Message-Id: <20210318003604.13621-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
| |
I don't want to have anything called "util", because that will
inevitably become a dumping ground for all sorts of unrelated stuff.
Message-Id: <20210318003545.13414-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
| |
This will save some cognitive load when reading main functions.
Message-Id: <20210318003530.13208-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
| |
Message-Id: <20210318003505.12895-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
| |
diee is our function that respects the verbosity setting.
Message-Id: <20210318001256.4078-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
| |
Message-Id: <20210318001240.3897-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
| |
Message-Id: <20210318001129.2891-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously this would (I assume) needlessly recompile vsockserver.c
and vsockclient.c when Make has already automatically compiled those.
GNU Make has an automatic variable, $+, that we could use here, but
currently the Makefile is portable, and it would be a shame to require
GNU Make just for that.
Message-Id: <20210310204555.20725-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
| |
This would result in the spawned process being hooked up to stdin,
instead of the vsock. Then stdin would be closed, so subsequent
processes would be connected to nothing. Oops.
Message-Id: <20210310204516.20041-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
|
| |
Previously, this returned the return value of connect(2), which is 0
on success. So stdin would be assigned to descriptors 6 and 7 in
vsockclient instead of the socket. Oops.
Message-Id: <20210309171816.8589-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|
|
|
|
|
|
| |
stdio can buffer output, so if we close stdout without going through
stdio, there might be buffered output that is never written.
Message-Id: <20210309154048.14474-1-hi@alyssa.is>
Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
|
|
|