crosvm/net_util/Cargo.toml
Daniel Verkamp b0406736ed net_util, devices: refactor platform-specific net code
The validate_and_configure_tap() and virtio_features_to_tap_offload()
functions already effectively did nothing on Windows, since the
implementations of these for Slirp were not provided. These functions
are moved to sys so the Linux-specific TAP interfaces are no longer
needed in TapTCommon.

The get_ifreq() function is only called internally inside the
implementation of the Linux Tap struct; it does not need to be part of
the TapT trait at all.

The MacAddress <-> sockaddr interop is only needed on Linux, and the
conversion can be moved into the get_mac_address and set_mac_address
implementations for Linux.

With these changes, net_sys is used only on Linux, so it can be
conditionally compiled and not included in non-Linux builds at all.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: I3419a3bdb1470c4d72588fe19e43fabcdfe4e451
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5046598
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-27 19:23:56 +00:00

40 lines
1 KiB
TOML

[package]
name = "net_util"
version = "0.1.0"
authors = ["The ChromiumOS Authors"]
edition = "2021"
build = 'build.rs'
[features]
guest-to-host-net-loopback = []
slirp = ["libslirp-sys", "pcap-file"]
slirp-debug = ["slirp"]
slirp-ring-capture = ["slirp"]
[dependencies]
base = { path = "../base" }
cfg-if = "1.0.0"
cros_async = { path = "../cros_async" }
libc = "*"
pcap-file = { version = "1.1.0", optional = true }
remain = "*"
serde = { version = "1", features = [ "derive" ] }
smallvec = "*"
thiserror = "*"
virtio_sys = { path = "../virtio_sys" }
zerocopy = { version = "0.7", features = ["derive"] }
[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
net_sys = { path = "../net_sys" }
[target.'cfg(windows)'.dependencies]
metrics = { path = "../metrics" }
winapi = { version = "*", features = ["everything", "std", "impl-default"] }
libslirp-sys = { version = "4.2.1", optional = true }
[build-dependencies]
anyhow = "*"
prebuilts = { path = "../prebuilts" }
[dev-dependencies]
serde_json = "*"