Skip to content

Commit 94a465e

Browse files
Merge branch 'main' into ipvlan_and_ipvtap
2 parents 8bab098 + 2f18ca4 commit 94a465e

60 files changed

Lines changed: 324 additions & 61 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
# Changelog
2+
## [0.19.0] - 2025-12-09
3+
### Breaking changes
4+
- Please check breaking changes of netlink-packet-route 0.19.0
5+
6+
### New features
7+
- vlan: Add wrapper for setting VLAN protocol and flags. (50fbcb3)
8+
- Add function on RouteMessageBuilder for setting route mark. (c0edfbf)
9+
- Support creating multicast netlink connection. (84dfe67)
10+
11+
### Bug fixes
12+
- Swap 'futures' dependency for 'futures-util' and 'futures-channel'. (26eda64)
13+
214
## [0.18.1] - 2025-09-09
315
### Breaking changes
416
- N/A

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rtnetlink"
3-
version = "0.18.1"
3+
version = "0.19.0"
44
authors = ["Corentin Henry <corentinhenry@gmail.com>"]
55
edition = "2021"
66
homepage = "https://github.com/rust-netlink/rtnetlink"
@@ -18,11 +18,12 @@ tokio_socket = ["netlink-proto/tokio_socket", "tokio"]
1818
smol_socket = ["netlink-proto/smol_socket", "async-global-executor"]
1919

2020
[dependencies]
21-
futures = "0.3.11"
21+
futures-util = "0.3.11"
22+
futures-channel = "0.3.11"
2223
log = "0.4.8"
2324
thiserror = "1"
2425
netlink-sys = { version = "0.8" }
25-
netlink-packet-route = { version = "0.25" }
26+
netlink-packet-route = { version = "0.26" }
2627
netlink-packet-core = { version = "0.8" }
2728
netlink-proto = { default-features = false, version = "0.12.0" }
2829
nix = { version = "0.30.0", default-features = false, features = ["fs", "mount", "sched", "signal"] }

examples/add_address.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::env;
44

5-
use futures::stream::TryStreamExt;
5+
use futures_util::stream::TryStreamExt;
66
use ipnetwork::IpNetwork;
77
use rtnetlink::{new_connection, Error, Handle};
88

examples/add_neighbour.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::{convert::TryFrom, env, net::IpAddr};
44

5-
use futures::stream::TryStreamExt;
5+
use futures_util::stream::TryStreamExt;
66
use rtnetlink::{new_connection, Error, Handle};
77

88
#[tokio::main]

examples/add_route_pref_src.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::{env, net::Ipv4Addr};
44

5-
use futures::TryStreamExt;
5+
use futures_util::TryStreamExt;
66
use ipnetwork::Ipv4Network;
77
use rtnetlink::{new_connection, Error, Handle, RouteMessageBuilder};
88

examples/create_macvlan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::{env, str::FromStr};
44

5-
use futures::stream::TryStreamExt;
5+
use futures_util::stream::TryStreamExt;
66
use macaddr::MacAddr;
77
use rtnetlink::{
88
new_connection, packet_route::link::MacVlanMode, Error, Handle, LinkMacVlan,

examples/create_macvtap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::env;
44

5-
use futures::stream::TryStreamExt;
5+
use futures_util::stream::TryStreamExt;
66
use rtnetlink::{
77
new_connection, packet_route::link::MacVtapMode, Error, Handle, LinkMacVtap,
88
};

examples/create_netkit.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
use rtnetlink::{new_connection, packet_route::link::NetkitMode, LinkNetkit};
4+
5+
#[tokio::main]
6+
async fn main() -> Result<(), String> {
7+
let (connection, handle, _) = new_connection().unwrap();
8+
tokio::spawn(connection);
9+
10+
// Create a netkit pair in L3 mode
11+
handle
12+
.link()
13+
.add(LinkNetkit::new("netkit0", "netkit0-peer", NetkitMode::L3).build())
14+
.execute()
15+
.await
16+
.map_err(|e| format!("{e}"))
17+
}

examples/create_netkit_advanced.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
use rtnetlink::{
4+
new_connection,
5+
packet_route::link::{NetkitMode, NetkitPolicy, NetkitScrub},
6+
LinkNetkit,
7+
};
8+
9+
#[tokio::main]
10+
async fn main() -> Result<(), String> {
11+
let (connection, handle, _) = new_connection().unwrap();
12+
tokio::spawn(connection);
13+
14+
// Create a fully-configured netkit pair in L3 mode
15+
// This example shows all available configuration options
16+
handle
17+
.link()
18+
.add(
19+
LinkNetkit::new("netkit0", "netkit0-peer", NetkitMode::L3)
20+
.policy(NetkitPolicy::Pass) // Forward packets normally on primary
21+
.peer_policy(NetkitPolicy::Pass) // Forward packets normally on peer
22+
.scrub(NetkitScrub::Default) // Apply default packet scrubbing
23+
.peer_scrub(NetkitScrub::Default) // Apply scrubbing on peer
24+
.headroom(256) // Reserve 256 bytes of headroom
25+
.tailroom(128) // Reserve 128 bytes of tailroom
26+
.up() // Bring the interface up
27+
.build(),
28+
)
29+
.execute()
30+
.await
31+
.map_err(|e| format!("{e}"))?;
32+
33+
println!("Created netkit pair: netkit0 <-> netkit0-peer");
34+
println!(" Mode: L3 (IP mode)");
35+
println!(" Policy: Pass (Forward)");
36+
println!(" Scrub: Default");
37+
println!(" Headroom: 256 bytes");
38+
println!(" Tailroom: 128 bytes");
39+
40+
Ok(())
41+
}

examples/create_vxlan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::env;
44

5-
use futures::stream::TryStreamExt;
5+
use futures_util::stream::TryStreamExt;
66
use rtnetlink::{new_connection, Error, Handle, LinkVxlan};
77

88
#[tokio::main]

0 commit comments

Comments
 (0)