diff options
author | Jorge E. Moreira <jemoreira@google.com> | 2019-02-12 16:43:05 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-02-14 05:27:29 -0800 |
commit | b795280ddcd9d290d89ff0e284bc12ae91640baf (patch) | |
tree | 1e239b71a3ac253b91410c87543c396cbfa950fb /src/linux.rs | |
parent | 348ccf1102895acf5a064d388ab8249c575ccafb (diff) | |
download | crosvm-b795280ddcd9d290d89ff0e284bc12ae91640baf.tar crosvm-b795280ddcd9d290d89ff0e284bc12ae91640baf.tar.gz crosvm-b795280ddcd9d290d89ff0e284bc12ae91640baf.tar.bz2 crosvm-b795280ddcd9d290d89ff0e284bc12ae91640baf.tar.lz crosvm-b795280ddcd9d290d89ff0e284bc12ae91640baf.tar.xz crosvm-b795280ddcd9d290d89ff0e284bc12ae91640baf.tar.zst crosvm-b795280ddcd9d290d89ff0e284bc12ae91640baf.zip |
Add support for multiple network interfaces
Allow --tap-fd to be given mutliple times, a different virtual network card will be added each time the flag is given. Additionally, --tap-fd is no longer mutually exclusive with --host-ip, etc. Bug=chromium:931470 Test=booted cuttlefish device with multiple network cards Change-Id: I4108f97c7f4b19db12fcb3c533088a04a58e56db Reviewed-on: https://chromium-review.googlesource.com/1469222 Commit-Ready: Jorge Moreira Broche <jemoreira@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Jorge Moreira Broche <jemoreira@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'src/linux.rs')
-rw-r--r-- | src/linux.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/linux.rs b/src/linux.rs index b81bc71..1dbd8fd 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -432,7 +432,7 @@ fn create_virtio_devs( }); // We checked above that if the IP is defined, then the netmask is, too. - if let Some(tap_fd) = cfg.tap_fd { + for tap_fd in cfg.tap_fd { // Safe because we ensure that we get a unique handle to the fd. let tap = unsafe { Tap::from_raw_fd(validate_raw_fd(tap_fd).map_err(Error::ValidateRawFd)?) @@ -449,7 +449,9 @@ fn create_virtio_devs( }; devs.push(VirtioDeviceStub { dev: net_box, jail }); - } else if let Some(host_ip) = cfg.host_ip { + } + + if let Some(host_ip) = cfg.host_ip { if let Some(netmask) = cfg.netmask { if let Some(mac_address) = cfg.mac_address { let net_box: Box<devices::virtio::VirtioDevice> = if cfg.vhost_net { |