Compare commits
2 Commits
ece1840885
...
b047bfe825
Author | SHA1 | Date |
---|---|---|
![]() |
b047bfe825 | |
![]() |
c9110dd8c5 |
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
Host unix/* vsock/* vsock-mux/*
|
Host unix/* unix,* vsock/* vsock,* vsock-mux/* vsock-mux,*
|
||||||
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p
|
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p
|
||||||
ProxyUseFdpass yes
|
ProxyUseFdpass yes
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@ -46,7 +46,7 @@ Host unix/* vsock/* vsock-mux/*
|
||||||
configuration fragment like the following:</para>
|
configuration fragment like the following:</para>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
Host unix/* vsock/* vsock-mux/*
|
Host unix/* unix,* vsock/* vsock,* vsock-mux/* vsock-mux,*
|
||||||
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p
|
ProxyCommand /usr/lib/systemd/systemd-ssh-proxy %h %p
|
||||||
ProxyUseFdpass yes
|
ProxyUseFdpass yes
|
||||||
CheckHostIP no
|
CheckHostIP no
|
||||||
|
@ -69,7 +69,9 @@ Host .host
|
||||||
direct <constant>AF_VSOCK</constant> communication between the host and guests, and provide their own
|
direct <constant>AF_VSOCK</constant> communication between the host and guests, and provide their own
|
||||||
multiplexer over <constant>AF_UNIX</constant> sockets. See
|
multiplexer over <constant>AF_UNIX</constant> sockets. See
|
||||||
<ulink url="https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/docs/vsock.md">cloud-hypervisor VSOCK support</ulink>
|
<ulink url="https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/docs/vsock.md">cloud-hypervisor VSOCK support</ulink>
|
||||||
and <ulink url="https://github.com/firecracker-microvm/firecracker/blob/main/docs/vsock.md">Using the Firecracker Virtio-vsock Device</ulink>.</para>
|
and <ulink url="https://github.com/firecracker-microvm/firecracker/blob/main/docs/vsock.md">Using the Firecracker Virtio-vsock Device</ulink>.
|
||||||
|
Note that <literal>,</literal> can be used as a separator instead of <literal>/</literal> to be
|
||||||
|
compatible with tools like <literal>scp</literal> and <literal>rsync</literal>.</para>
|
||||||
|
|
||||||
<para>Moreover, connecting to <literal>.host</literal> will connect to the local host via SSH, without
|
<para>Moreover, connecting to <literal>.host</literal> will connect to the local host via SSH, without
|
||||||
involving networking.</para>
|
involving networking.</para>
|
||||||
|
@ -113,6 +115,12 @@ Host .host
|
||||||
|
|
||||||
<programlisting>ssh unix/run/ssh-unix-local/socket</programlisting>
|
<programlisting>ssh unix/run/ssh-unix-local/socket</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<example>
|
||||||
|
<title>Copy local 'foo' file to a local VM with CID 1348</title>
|
||||||
|
|
||||||
|
<programlisting>scp foo vsock,1348:</programlisting>
|
||||||
|
</example>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
|
|
|
@ -9,7 +9,7 @@ Host .host machine/.host
|
||||||
# Make sure unix/* and vsock/* can be used to connect to AF_UNIX and AF_VSOCK paths.
|
# Make sure unix/* and vsock/* can be used to connect to AF_UNIX and AF_VSOCK paths.
|
||||||
# Make sure machine/* can be used to connect to local machines registered in machined.
|
# Make sure machine/* can be used to connect to local machines registered in machined.
|
||||||
#
|
#
|
||||||
Host unix/* vsock/* vsock-mux/* machine/*
|
Host unix/* unix,* vsock/* vsock,* vsock-mux/* vsock-mux,* machine/* machine,*
|
||||||
ProxyCommand {{LIBEXECDIR}}/systemd-ssh-proxy %h %p
|
ProxyCommand {{LIBEXECDIR}}/systemd-ssh-proxy %h %p
|
||||||
ProxyUseFdpass yes
|
ProxyUseFdpass yes
|
||||||
CheckHostIP no
|
CheckHostIP no
|
||||||
|
|
|
@ -175,6 +175,15 @@ static int process_machine(const char *machine, const char *port) {
|
||||||
return process_vsock_cid(cid, port);
|
return process_vsock_cid(cid, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *startswith_sep(const char *s, const char *prefix) {
|
||||||
|
const char *p = startswith(s, prefix);
|
||||||
|
|
||||||
|
if (p && IN_SET(*p, '/', ','))
|
||||||
|
return (char*) p + 1;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static int run(int argc, char* argv[]) {
|
static int run(int argc, char* argv[]) {
|
||||||
|
|
||||||
log_setup();
|
log_setup();
|
||||||
|
@ -184,19 +193,19 @@ static int run(int argc, char* argv[]) {
|
||||||
|
|
||||||
const char *host = argv[1], *port = argv[2];
|
const char *host = argv[1], *port = argv[2];
|
||||||
|
|
||||||
const char *p = startswith(host, "vsock/");
|
const char *p = startswith_sep(host, "vsock");
|
||||||
if (p)
|
if (p)
|
||||||
return process_vsock_string(p, port);
|
return process_vsock_string(p, port);
|
||||||
|
|
||||||
p = startswith(host, "unix/");
|
p = startswith_sep(host, "unix");
|
||||||
if (p)
|
if (p)
|
||||||
return process_unix(p);
|
return process_unix(p);
|
||||||
|
|
||||||
p = startswith(host, "vsock-mux/");
|
p = startswith_sep(host, "vsock-mux");
|
||||||
if (p)
|
if (p)
|
||||||
return process_vsock_mux(p, port);
|
return process_vsock_mux(p, port);
|
||||||
|
|
||||||
p = startswith(host, "machine/");
|
p = startswith_sep(host, "machine");
|
||||||
if (p)
|
if (p)
|
||||||
return process_machine(p, port);
|
return process_machine(p, port);
|
||||||
|
|
||||||
|
|
|
@ -61,4 +61,13 @@ ssh -o StrictHostKeyChecking=no -v -i "$ROOTID" machine/.host cat /etc/machine-i
|
||||||
modprobe vsock_loopback ||:
|
modprobe vsock_loopback ||:
|
||||||
if test -e /dev/vsock -a -d /sys/module/vsock_loopback ; then
|
if test -e /dev/vsock -a -d /sys/module/vsock_loopback ; then
|
||||||
ssh -o StrictHostKeyChecking=no -v -i "$ROOTID" vsock/1 cat /etc/machine-id | cmp - /etc/machine-id
|
ssh -o StrictHostKeyChecking=no -v -i "$ROOTID" vsock/1 cat /etc/machine-id | cmp - /etc/machine-id
|
||||||
|
|
||||||
|
if ! command -v scp &> /dev/null ; then
|
||||||
|
echo "scp not found, skipping subtest" >&2
|
||||||
|
else
|
||||||
|
OUT_FILE=$(mktemp -u)
|
||||||
|
scp -o StrictHostKeyChecking=no -v -i "$ROOTID" vsock,1:/etc/machine-id "$OUT_FILE"
|
||||||
|
cmp "$OUT_FILE" /etc/machine-id
|
||||||
|
rm -f "$OUT_FILE"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue