diff --git a/Cargo.toml b/Cargo.toml index b4859b7..0859cfb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ smol_socket = ["netlink-sys/smol_socket"] [dev-dependencies] env_logger = "0.8.2" tokio = { version = "1.0.1", default-features = false, features = ["macros", "rt-multi-thread"] } -netlink-packet-route = { version = "0.14.1" } +netlink-packet-route = { version = "0.18.1" } netlink-packet-audit = { version = "0.5.0" } async-std = {version = "1.9.0", features = ["attributes"]} @@ -37,7 +37,7 @@ name = "dump_links" [[example]] name = "dump_links_async" -required-features = ["smol_socket"] +required-features = ["tokio_socket"] [[example]] name = "audit_netlink_events" diff --git a/examples/audit_netlink_events.rs b/examples/audit_netlink_events.rs index 8ab49ce..55dd505 100644 --- a/examples/audit_netlink_events.rs +++ b/examples/audit_netlink_events.rs @@ -49,8 +49,8 @@ async fn main() -> Result<(), String> { // - `messages` is a channel receiver through which we receive messages that // we have not sollicated, ie that are not response to a request we made. // In this example, we'll receive the audit event through that channel. - let (conn, mut handle, mut messages) = new_connection(NETLINK_AUDIT) - .map_err(|e| { + let (conn, handle, mut messages) = + new_connection(NETLINK_AUDIT).map_err(|e| { format!("Failed to create a new netlink connection: {e}") })?; diff --git a/examples/dump_links.rs b/examples/dump_links.rs index 838356b..c3451c4 100644 --- a/examples/dump_links.rs +++ b/examples/dump_links.rs @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT use futures::StreamExt; -use netlink_packet_route::{ - LinkMessage, NetlinkHeader, NetlinkMessage, RtnlMessage, NLM_F_DUMP, - NLM_F_REQUEST, +use netlink_packet_core::{ + NetlinkHeader, NetlinkMessage, NLM_F_DUMP, NLM_F_REQUEST, }; +use netlink_packet_route::{link::LinkMessage, RouteNetlinkMessage}; use netlink_proto::{ new_connection, sys::{protocols::NETLINK_ROUTE, SocketAddr}, @@ -14,7 +14,7 @@ use netlink_proto::{ async fn main() -> Result<(), String> { // Create the netlink socket. Here, we won't use the channel that // receives unsolicited messages. - let (conn, mut handle, _) = new_connection(NETLINK_ROUTE).map_err(|e| { + let (conn, handle, _) = new_connection(NETLINK_ROUTE).map_err(|e| { format!("Failed to create a new netlink connection: {e}") })?; @@ -26,7 +26,7 @@ async fn main() -> Result<(), String> { nl_hdr.flags = NLM_F_DUMP | NLM_F_REQUEST; let request = NetlinkMessage::new( nl_hdr, - RtnlMessage::GetLink(LinkMessage::default()).into(), + RouteNetlinkMessage::GetLink(LinkMessage::default()).into(), ); // Send the request diff --git a/examples/dump_links_async.rs b/examples/dump_links_async.rs index 7289caa..a8debea 100644 --- a/examples/dump_links_async.rs +++ b/examples/dump_links_async.rs @@ -1,20 +1,20 @@ // SPDX-License-Identifier: MIT use futures::StreamExt; -use netlink_packet_route::{ - LinkMessage, NetlinkHeader, NetlinkMessage, RtnlMessage, NLM_F_DUMP, - NLM_F_REQUEST, +use netlink_packet_core::{ + NetlinkHeader, NetlinkMessage, NLM_F_DUMP, NLM_F_REQUEST, }; +use netlink_packet_route::{link::LinkMessage, RouteNetlinkMessage}; use netlink_proto::{ new_connection, sys::{protocols::NETLINK_ROUTE, SocketAddr}, }; -#[async_std::main] +#[tokio::main] async fn main() -> Result<(), String> { // Create the netlink socket. Here, we won't use the channel that // receives unsolicited messages. - let (conn, mut handle, _) = new_connection(NETLINK_ROUTE).map_err(|e| { + let (conn, handle, _) = new_connection(NETLINK_ROUTE).map_err(|e| { format!("Failed to create a new netlink connection: {}", e) })?; @@ -27,7 +27,7 @@ async fn main() -> Result<(), String> { nl_hdr.flags = NLM_F_DUMP | NLM_F_REQUEST; let request = NetlinkMessage::new( nl_hdr, - RtnlMessage::GetLink(LinkMessage::default()).into(), + RouteNetlinkMessage::GetLink(LinkMessage::default()).into(), ); // Send the request diff --git a/src/lib.rs b/src/lib.rs index c90232e..7222fc6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,13 +110,11 @@ //! ```rust,no_run //! use futures::StreamExt; //! -//! use netlink_packet_route::{ -//! LinkMessage, +//! use netlink_packet_route::{link::LinkMessage, RouteNetlinkMessage}; +//! use netlink_packet_core::{ //! NetlinkHeader, //! NetlinkMessage, -//! RtnlMessage, -//! NLM_F_DUMP, -//! NLM_F_REQUEST, +//! NLM_F_REQUEST, NLM_F_DUMP //! }; //! //! use netlink_proto::{ @@ -140,7 +138,7 @@ //! //! let msg = NetlinkMessage::new( //! nl_hdr, -//! RtnlMessage::GetLink(LinkMessage::default()).into(), +//! RouteNetlinkMessage::GetLink(LinkMessage::default()).into(), //! ); //! //! // Send the request