Skip to content

Commit 6574393

Browse files
committed
Bump rtnetlink version to the latest
Signed-off-by: Guvenc Gulce <[email protected]>
1 parent f782faa commit 6574393

File tree

7 files changed

+38
-65
lines changed

7 files changed

+38
-65
lines changed

Cargo.lock

Lines changed: 15 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ digest = "0.10"
3838
clap = { version = "4.5.48", features = ["derive", "env"] }
3939
dotenvy = { version = "0.15"}
4040
libc = "0.2"
41-
rtnetlink = "0.14.1"
42-
netlink-packet-route = "~0.19.0"
41+
rtnetlink = "0.18.1"
42+
netlink-packet-route = "~0.25.0"
4343
pnet = "0.35.0"
4444
dhcproto = "0.13.0"
4545
socket2 = "0.6.0"

feos/services/image-service/src/worker.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use feos_proto::image_service::{
88
};
99
use log::{error, info, warn};
1010
use oci_distribution::{
11-
client::{ClientConfig, ClientProtocol},
12-
errors::OciDistributionError,
13-
secrets, Client, ParseError, Reference,
11+
client::ClientConfig, errors::OciDistributionError, secrets, Client, ParseError, Reference,
1412
};
1513
use std::collections::HashMap;
1614
use tokio::sync::{broadcast, mpsc, oneshot};
@@ -221,10 +219,7 @@ async fn download_layer_data(image_ref: &str) -> Result<Vec<u8>, PullError> {
221219
VMLINUZ_MEDIA_TYPE,
222220
];
223221

224-
let insecure_registries = vec!["ghcr.io:5000".to_string()];
225-
226222
let config = ClientConfig {
227-
protocol: ClientProtocol::HttpsExcept(insecure_registries),
228223
..Default::default()
229224
};
230225

feos/utils/src/network/dhcpv6.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use dhcproto::v6::*;
55
use futures::stream::TryStreamExt;
66
use log::{error, info, warn};
77
use netlink_packet_route::route::{
8-
RouteAddress, RouteAttribute, RouteProtocol, RouteScope, RouteType,
8+
RouteAddress, RouteAttribute, RouteMessage, RouteProtocol, RouteScope, RouteType,
99
};
1010
use netlink_packet_route::AddressFamily;
1111
use nix::net::if_::if_nametoindex;
@@ -498,8 +498,8 @@ pub async fn add_ipv6_route(
498498
.try_next()
499499
.await?
500500
.ok_or(Error::RequestFailed)?;
501-
let mut req = handle.route().add();
502-
let msg = req.message_mut();
501+
502+
let mut msg = RouteMessage::default();
503503
msg.header.address_family = AddressFamily::Inet6;
504504
msg.header.scope = RouteScope::Universe;
505505
msg.header.protocol = RouteProtocol::Static;
@@ -515,7 +515,8 @@ pub async fn add_ipv6_route(
515515
}
516516
msg.attributes.push(RouteAttribute::Oif(link.header.index));
517517
msg.attributes.push(RouteAttribute::Priority(metric));
518-
req.execute().await
518+
519+
handle.route().add(msg).execute().await
519520
}
520521

521522
pub async fn set_ipv6_gateway(
@@ -531,8 +532,8 @@ pub async fn set_ipv6_gateway(
531532
.try_next()
532533
.await?
533534
.ok_or(Error::RequestFailed)?;
534-
let mut req = handle.route().add();
535-
let msg = req.message_mut();
535+
536+
let mut msg = RouteMessage::default();
536537
msg.header.address_family = AddressFamily::Inet6;
537538
msg.header.scope = RouteScope::Universe;
538539
msg.header.protocol = RouteProtocol::Static;
@@ -541,5 +542,6 @@ pub async fn set_ipv6_gateway(
541542
msg.attributes
542543
.push(RouteAttribute::Gateway(RouteAddress::Inet6(ipv6_gateway)));
543544
msg.attributes.push(RouteAttribute::Oif(link.header.index));
544-
req.execute().await
545+
546+
handle.route().add(msg).execute().await
545547
}

feos/utils/src/network/utils.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use super::dhcpv6::*;
55
use futures::stream::TryStreamExt;
66
use log::{error, info, warn};
77
use netlink_packet_route::route::RouteType;
8+
use netlink_packet_route::link::{LinkAttribute, LinkFlags, LinkMessage};
89
use rtnetlink::new_connection;
910
use std::fs::File;
1011
use std::io;
@@ -162,24 +163,28 @@ pub async fn configure_network_devices() -> Result<Option<(Ipv6Addr, u8)>, Strin
162163
.map_err(|e| format!("{interface_name} not found: {e}"))?
163164
.ok_or("Link not found".to_string())?;
164165

166+
let mut link_msg = LinkMessage::default();
167+
link_msg.header.index = link.header.index;
168+
link_msg.header.flags = link.header.flags | LinkFlags::Up;
169+
link_msg.header.change_mask = LinkFlags::Up;
170+
165171
handle
166172
.link()
167-
.set(link.header.index)
168-
.up()
173+
.set(link_msg)
169174
.execute()
170175
.await
171176
.map_err(|e| format!("{interface_name} can not be set up: {e}"))?;
172177

173178
info!("{interface_name}:");
174179
for attr in link.attributes {
175180
match attr {
176-
netlink_packet_route::link::LinkAttribute::Address(mac_bytes) => {
181+
LinkAttribute::Address(mac_bytes) => {
177182
info!(" mac: {}", format_mac(mac_bytes.clone()));
178183
}
179-
netlink_packet_route::link::LinkAttribute::Carrier(carrier) => {
184+
LinkAttribute::Carrier(carrier) => {
180185
info!(" carrier: {carrier}");
181186
}
182-
netlink_packet_route::link::LinkAttribute::Mtu(mtu) => {
187+
LinkAttribute::Mtu(mtu) => {
183188
info!(" mtu: {mtu}");
184189
}
185190
_ => (),

hack/initramfs/mk-initramfs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ cat <<EOF >>etc/hosts
2323
127.0.0.1 localhost
2424
127.0.1.1 feos
2525
::1 localhost feos
26-
2a10:afc0:e013:fe01:: ghcr.io
2726
EOF
2827

2928
echo "feos" > etc/hostname

hack/kernel/cmdline.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
console=tty0 console=ttyS0,115200
1+
console=tty0

0 commit comments

Comments
 (0)