Skip to content

Commit

Permalink
Update netlink-packet-core to 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ghananigans committed Jul 9, 2023
1 parent 5f460ee commit bb543f0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rich_nlas = []
anyhow = "1.0.31"
byteorder = "1.3.2"
libc = "0.2.66"
netlink-packet-core = { version = "0.6.0" }
netlink-packet-core = { version = "0.7.0" }
netlink-packet-utils = { version = "0.5.2" }
bitflags = "1.2.1"

Expand Down
2 changes: 1 addition & 1 deletion examples/dump_neighbours.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn main() {
print_entry(entry);
}
}
NetlinkPayload::Error(err) => {
NetlinkPayload::Error(err) if err.code.is_none() => {
eprintln!("Received a netlink error message: {err:?}");
return;
}
Expand Down
9 changes: 6 additions & 3 deletions examples/new_rule.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT

use netlink_packet_core::{
NetlinkHeader, NetlinkMessage, NetlinkPayload, NLM_F_ACK, NLM_F_CREATE,
NLM_F_EXCL, NLM_F_REQUEST,
ErrorMessage, NetlinkHeader, NetlinkMessage, NetlinkPayload, NLM_F_ACK,
NLM_F_CREATE, NLM_F_EXCL, NLM_F_REQUEST,
};
use netlink_packet_route::{
constants::{AF_INET, FR_ACT_TO_TBL, RT_TABLE_DEFAULT},
Expand Down Expand Up @@ -54,7 +54,10 @@ fn main() {
let rx_packet = <NetlinkMessage<RtnlMessage>>::deserialize(bytes);
println!("<<< {rx_packet:?}");
if let Ok(rx_packet) = rx_packet {
if let NetlinkPayload::Error(e) = rx_packet.payload {
if let NetlinkPayload::Error(
e @ ErrorMessage { code: Some(_), .. },
) = rx_packet.payload
{
eprintln!("{e:?}");
} else {
return;
Expand Down

0 comments on commit bb543f0

Please sign in to comment.