summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2023-09-06 18:46:22 -0400
committerReinhard Tartler <siretart@tauware.de>2023-09-06 18:46:22 -0400
commitaef380508b8d1c8f9ad0164f9c442ce51b6d09ee (patch)
treead4347db5733376a000eca1d05000b5b4c49a227
parentcb2faa49f49fe70106fc3bc2eca94393d1f12ff0 (diff)
netlink-0.7
This patch is based on the upstream commit described below, adjusted for use in the Debian package by Peter Michael Green. commit f92a065483828ba172c858e6cbc46f75a8b933d9 Author: Paul Holzinger <pholzing@redhat.com> Date: Mon Jul 10 14:54:12 2023 +0200 bump netlink deps There are breaking changes here so fix them, sigh. Signed-off-by: Paul Holzinger <pholzing@redhat.com> Gbp-Pq: Name netlink-0.7.patch
-rw-r--r--Cargo.toml4
-rw-r--r--src/network/bridge.rs4
-rw-r--r--src/network/macvlan.rs2
-rw-r--r--src/network/netlink.rs8
4 files changed, 9 insertions, 9 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 6cad2d2..8e503bc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -34,8 +34,8 @@ zbus = { version = "3.6.1" }
nix = "0.26.1"
rand = "0.8"
sha2 = "0.10"
-netlink-packet-route = "0.15"
-netlink-packet-core = "0.5"
+netlink-packet-route = "0.17.0"
+netlink-packet-core = "0.7.0"
fs2 = "0.4.3"
netlink-sys = "0.8.3"
diff --git a/src/network/bridge.rs b/src/network/bridge.rs
index aa170aa..34722d7 100644
--- a/src/network/bridge.rs
+++ b/src/network/bridge.rs
@@ -471,7 +471,7 @@ fn create_interfaces(
Ok(bridge) => check_link_is_bridge(bridge, &data.bridge_interface_name)?,
Err(err) => match err.unwrap() {
NetavarkError::Netlink(e) => {
- if -e.code != libc::ENODEV {
+ if -e.raw_code() != libc::ENODEV {
// if bridge does not exists we will create it below,
// for all other errors we want to return the error
return Err(err).wrap("get bridge interface");
@@ -551,7 +551,7 @@ fn create_veth_pair(
host_veth.info_data = Some(InfoData::Veth(VethInfo::Peer(peer)));
host.create_link(host_veth).map_err(|err| match err {
- NetavarkError::Netlink(ref e) if -e.code == libc::EEXIST => NetavarkError::wrap(
+ NetavarkError::Netlink(ref e) if -e.raw_code() == libc::EEXIST => NetavarkError::wrap(
format!(
"create veth pair: interface {} already exists on container namespace",
data.container_interface_name
diff --git a/src/network/macvlan.rs b/src/network/macvlan.rs
index a0ec302..ab96586 100644
--- a/src/network/macvlan.rs
+++ b/src/network/macvlan.rs
@@ -181,7 +181,7 @@ fn setup(
Ok(_) => break,
Err(err) => match err {
- NetavarkError::Netlink(ref e) if -e.code == libc::EEXIST => {
+ NetavarkError::Netlink(ref e) if -e.raw_code() == libc::EEXIST => {
let random = Alphanumeric.sample_string(&mut rand::thread_rng(), 10);
let tmp_name = "mv-".to_string() + &random;
let mut opts = opts.clone();
diff --git a/src/network/netlink.rs b/src/network/netlink.rs
index c66ab17..30a9320 100644
--- a/src/network/netlink.rs
+++ b/src/network/netlink.rs
@@ -207,7 +207,7 @@ impl Socket {
Ok(result) => result,
Err(err) => match err {
// kernel returns EACCES when we try to add an ipv6 but ipv6 is disabled in the kernel
- NetavarkError::Netlink(ref e) if -e.code == libc::EACCES => match addr {
+ NetavarkError::Netlink(ref e) if -e.raw_code() == libc::EACCES => match addr {
ipnet::IpNet::V6(_) => {
return Err(NetavarkError::wrap(
"failed to add ipv6 address, is ipv6 enabled in the kernel?",
@@ -417,9 +417,9 @@ impl Socket {
}
match rx_packet.payload {
- NetlinkPayload::Done => return Ok(result),
- NetlinkPayload::Error(e) | NetlinkPayload::Ack(e) => {
- if e.code != 0 {
+ NetlinkPayload::Done(_) => return Ok(result),
+ NetlinkPayload::Error(e) => {
+ if e.code.is_some() {
return Err(e.into());
}
return Ok(result);