No description
Find a file
Alexandre Courbot 993aa7fd49 crosvm: add option to use persistent TAP interface as network device
Currently we have two ways to enable networking on crosvm:

1) Pass all 3 of `--host_ip`, `--netmask` and `--mac` to have crosvm
create and configure a TAP device. This requires crosvm to either be run
as root, or to have the CAP_NET_ADMIN capability,

2) Have another process with the above privileges create and configure
the TAP device before exec'ing crosvm with the TAP FD still open and
passing it to crosvm with the `--tap-fd` argument.

None of these ways are very convenient for development as they either
require to get some privilege every time crosvm is invoked, or to use
another program (not distributed with crosvm) to do the setup.

This patch adds the `tap-name` command-line option which allows to
create a network device from a configured persistent TAP interface,
which doesn't require any kind of privilege.

A persistent TAP interface can be configured on the host as follows:

    # ip tuntap add mode tap user $USER vnet_hdr crosvm_tap
    # ip addr add 10.0.2.1/24 dev crosvm_tap
    # ip link set crosvm_tap up

Then after this one-time setup, $USER will be able to use the
`crosvm_tap` interface by simply passing `--tap-name crosvm_tap` to
crosvm, without any extra option or tool.

This is convenient for development setups as one just needs to
permanently configure the TAP interface using standard Linux tools on
the host once.

BUG=None
TEST=Check that networking works after passing `--tap-name` to crosvm.

Change-Id: Id053a97d69e47a6fefdbe7f3134841d2bfa1757b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3325827
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2021-12-10 07:31:03 +00:00
.cargo Uprev rust toolchain to 1.56.1 2021-12-10 02:34:50 +00:00
.devcontainer Add new dev container and install-deps scripts 2021-10-15 22:12:02 +00:00
.github tools: Add cargo-doc script 2021-12-09 14:34:31 +00:00
aarch64 Linux: Change root_config from PciConfigArch to PciRoot 2021-12-08 12:30:28 +00:00
acpi_tables x86_64: Add _OSC for pcie hotplug 2021-12-09 00:19:42 +00:00
arch Linux: Change root_config from PciConfigArch to PciRoot 2021-12-08 12:30:28 +00:00
bin Deprecate old dev tooling scripts 2021-11-02 22:23:03 +00:00
bit_field
ci/kokoro tools: Add cargo-doc script 2021-12-09 14:34:31 +00:00
common sys_util: impl From<UnixSeqpacket> for SafeDescriptor 2021-12-09 20:16:12 +00:00
crosvm-fuzz Refactoring: Move various general purpose crates to common/ 2021-10-29 22:31:43 +00:00
crosvm_plugin sys_util: Replace unsafe use of iovecs 2021-11-26 14:28:28 +00:00
devices crosvm: add option to use persistent TAP interface as network device 2021-12-10 07:31:03 +00:00
disk Handle qcow image backed by a composite disk 2021-11-11 11:08:48 +00:00
docs/book ./tools/presubmit: Parallel execution and use dev container 2021-11-19 20:09:40 +00:00
fuse fuse: Set max_pages in InitOut 2021-11-25 03:56:08 +00:00
gpu_display cleanup: Fix previously disabled clippy checks 2021-11-12 23:23:48 +00:00
hypervisor Enable clippy on more workspace crates 2021-11-15 23:55:42 +00:00
integration_tests Enable clippy on more workspace crates 2021-11-15 23:55:42 +00:00
kernel_cmdline
kernel_loader Enable clippy on more workspace crates 2021-11-15 23:55:42 +00:00
kvm aarch64: Provide the maximum supported IPA size as the machine type 2021-11-01 14:24:27 +00:00
kvm_sys Refactoring: Move various general purpose crates to common/ 2021-10-29 22:31:43 +00:00
libcras_stub
libcrosvm_control Enable clippy on more workspace crates 2021-11-15 23:55:42 +00:00
libvda enumn: switch to upstream crates.io version 2021-11-15 21:03:25 +00:00
linux_input_sys Refactoring: Move various general purpose crates to common/ 2021-10-29 22:31:43 +00:00
logo README: Use PNG logo image 2021-10-29 01:56:23 +00:00
net_sys Refactoring: Move various general purpose crates to common/ 2021-10-29 22:31:43 +00:00
net_util crosvm: add option to use persistent TAP interface as network device 2021-12-10 07:31:03 +00:00
power_monitor Refactoring: Move various general purpose crates to common/ 2021-10-29 22:31:43 +00:00
protos
qcow_utils Enable clippy on more workspace crates 2021-11-15 23:55:42 +00:00
resources resources: Release pci slot when vfio pci device is removed 2021-11-19 22:10:15 +00:00
rutabaga_gfx rutabaga_gfx: fix gfxstream build 2021-12-10 01:54:35 +00:00
seccomp devices: gpu: add render server support 2021-12-09 20:16:13 +00:00
src crosvm: add option to use persistent TAP interface as network device 2021-12-10 07:31:03 +00:00
system_api_stub system_api_stub: use 2018 edition of Rust 2021-09-09 06:42:46 +00:00
tests
third_party vmm_vhost: Remove SlaveReqHandler type parameter in SlaveReqHelper 2021-12-08 14:50:59 +00:00
tools Uprev rust toolchain to 1.56.1 2021-12-10 02:34:50 +00:00
tpm2
tpm2-sys Uprev all submodules 2021-10-19 19:12:53 +00:00
usb_sys Refactoring: Move various general purpose crates to common/ 2021-10-29 22:31:43 +00:00
usb_util Enable clippy on more workspace crates 2021-11-15 23:55:42 +00:00
vfio_sys Refactoring: Move various general purpose crates to common/ 2021-10-29 22:31:43 +00:00
vhost devices: vhost: Allow vhost-vsock fd from command-line 2021-11-18 15:19:29 +00:00
virtio_sys Refactoring: Move various general purpose crates to common/ 2021-10-29 22:31:43 +00:00
vm_control devices:vfio-pci: Handle vfio pci device bar reallocation 2021-11-19 22:10:09 +00:00
vm_memory Revert "vm-memory: mlock2(MLOCK_ONFAULT) guest memory for protected VMs" 2021-12-02 11:28:53 +00:00
x86_64 x86_64: Change E820Type from constants to enum 2021-12-09 00:19:44 +00:00
.dockerignore
.gitignore Add test runner ./tools/run_tests 2021-10-15 22:12:03 +00:00
.gitmodules
.rustfmt.toml
ARCHITECTURE.md crosvm: Add a note that MemoryMapping does RAII. 2021-11-30 09:24:16 +00:00
Cargo.toml cros_asyncv2: Add crate 2021-12-09 12:33:02 +00:00
CONTRIBUTING.md crosvm: Add link to the chromeos-base/crosvm topic. 2021-11-30 09:23:55 +00:00
LICENSE
navbar.md navbar: Update navbar contents 2021-10-29 01:56:24 +00:00
OWNERS OWNERS: add dtor@ 2021-12-06 20:36:52 +00:00
README.chromeos Add documentation for ChromeOS integration 2021-12-08 18:50:50 +00:00
README.md crosvm: Sprinkle notes on API search. 2021-11-08 07:21:20 +00:00
run_tests Deprecate old dev tooling scripts 2021-11-02 22:23:03 +00:00
rust-toolchain Uprev rust toolchain to 1.56.1 2021-12-10 02:34:50 +00:00
setup_cros_cargo.sh Deprecate old dev tooling scripts 2021-11-02 22:23:03 +00:00
test_all Deprecate old dev tooling scripts 2021-11-02 22:23:03 +00:00
unblocked_terms.txt

crosvm - The Chrome OS Virtual Machine Monitor

crosvm is a virtual machine monitor (VMM) based on Linuxs KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the Chrome OS platform. Compared to QEMU, crosvm doesnt emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.

crosvm is currently used to run Linux/Android guests on Chrome OS devices.

Logo