From 6e346fec3f9451527195cf44c16dfbf91c210890 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:29:07 +0000 Subject: [PATCH] Bump the netlink group with 2 updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the netlink group with 2 updates: [netlink-packet-route](https://github.com/rust-netlink/netlink-packet-route) and [rtnetlink](https://github.com/rust-netlink/rtnetlink). Updates `netlink-packet-route` from 0.17.1 to 0.18.1 - [Release notes](https://github.com/rust-netlink/netlink-packet-route/releases) - [Changelog](https://github.com/rust-netlink/netlink-packet-route/blob/main/CHANGELOG) - [Commits](https://github.com/rust-netlink/netlink-packet-route/compare/v0.17.1...v0.18.1) Updates `rtnetlink` from 0.13.1 to 0.14.0 - [Release notes](https://github.com/rust-netlink/rtnetlink/releases) - [Changelog](https://github.com/rust-netlink/rtnetlink/blob/main/CHANGELOG) - [Commits](https://github.com/rust-netlink/rtnetlink/compare/v0.13.1...v0.14.0) --- updated-dependencies: - dependency-name: netlink-packet-route dependency-type: direct:production update-type: version-update:semver-minor dependency-group: netlink - dependency-name: rtnetlink dependency-type: direct:production update-type: version-update:semver-minor dependency-group: netlink ... Co-authored-by: Martin Kröning --- Cargo.lock | 34 ++++++++-------------------------- Cargo.toml | 4 ++-- src/network.rs | 30 +++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f96ee60b..5eb03b3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bb11bd1378bf3731b182997b40cefe00aba6a6cc74042c8318c1b271d3badf7" dependencies = [ - "nix 0.27.1", + "nix", "thiserror", ] @@ -600,14 +600,14 @@ dependencies = [ [[package]] name = "netlink-packet-route" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053998cea5a306971f88580d0829e90f270f940befd7cf928da179d4187a5a66" +checksum = "dd9ccdfabb457e05c7c61e66eb39262a204fbb376c53968b5e52dce15b423fc5" dependencies = [ "anyhow", - "bitflags 1.3.2", "byteorder", "libc", + "log", "netlink-packet-core", "netlink-packet-utils", ] @@ -652,18 +652,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "nix" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "static_assertions", -] - [[package]] name = "nix" version = "0.27.1" @@ -839,9 +827,9 @@ dependencies = [ [[package]] name = "rtnetlink" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a552eb82d19f38c3beed3f786bd23aa434ceb9ac43ab44419ca6d67a7e186c0" +checksum = "bb5bbb61e037711ff30a3657ec537285b2e1ecb5427e4365d275164f0928c884" dependencies = [ "futures", "log", @@ -850,7 +838,7 @@ dependencies = [ "netlink-packet-utils", "netlink-proto", "netlink-sys", - "nix 0.26.2", + "nix", "thiserror", "tokio", ] @@ -870,7 +858,7 @@ dependencies = [ "log", "netlink-packet-core", "netlink-packet-route", - "nix 0.27.1", + "nix", "oci-spec", "path-clean", "procfs", @@ -1046,12 +1034,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "strsim" version = "0.10.0" diff --git a/Cargo.toml b/Cargo.toml index f5f8e089..94cbffa5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ goblin = { version = "0.8", default-features = false, features = ["elf64", "elf3 libc = "0.2" log = { version = "0.4", features = ["std"] } netlink-packet-core = "0.7" -netlink-packet-route = "0.17" +netlink-packet-route = "0.18" nix = { version = "0.27", features = [ "hostname", "ioctl", @@ -38,7 +38,7 @@ nix = { version = "0.27", features = [ oci-spec = "0.6" path-clean = "1.0" procfs = { version = "0.15", default-features = false } -rtnetlink = "0.13" +rtnetlink = "0.14" serde_json = "1.0" serde = "1.0" time = { version = "0.3", features = ["formatting"] } diff --git a/src/network.rs b/src/network.rs index bf3b225b..f6a0a536 100644 --- a/src/network.rs +++ b/src/network.rs @@ -1,12 +1,18 @@ use futures::TryStreamExt; use netlink_packet_core::ErrorMessage; -use netlink_packet_route::{address, link, route, MACVLAN_MODE_PASSTHRU}; +use netlink_packet_route::address::AddressAttribute; +use netlink_packet_route::link::LinkAttribute; +use netlink_packet_route::route::{RouteAddress, RouteAttribute}; use nix::sys::stat::SFlag; use rtnetlink::Error::NetlinkError; +use std::net::IpAddr; use std::num::NonZeroI32; use std::path::PathBuf; use std::{error::Error, fmt, net::Ipv4Addr}; +// FIXME: https://github.com/rust-netlink/netlink-packet-route/issues/88 +const MACVLAN_MODE_PASSTHRU: u32 = 8; + #[derive(Debug)] struct VirtioNetworkError { details: String, @@ -117,9 +123,12 @@ pub async fn create_tap() -> Result ip_address = Some(addr), + IpAddr::V6(_) => panic!(), + } prefix_length = Some(device_addr_msg.header.prefix_len); } } @@ -127,9 +136,12 @@ pub async fn create_tap() -> Result gateway_address = Some(addr), + _ => panic!(), + } break; } } @@ -158,8 +170,8 @@ pub async fn create_tap() -> Result