Skip to content

Commit 763f508

Browse files
committed
Use latest rust-netlink crates
* Drop the need of netlink-packet-utils * Upgrade to netlink-packet-core 0.8.1 * Drop the need of byteorder Signed-off-by: Gris Ge <[email protected]>
1 parent 6efa5ce commit 763f508

Some content is hidden

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

78 files changed

+182
-307
lines changed

.rustfmt.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
max_width = 80
22
wrap_comments = true
33
reorder_imports = true
4+
format_strings = true
5+
group_imports = "StdExternalCrate"
6+
imports_granularity = "Crate"
47
edition = "2021"

Cargo.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "netlink-packet-xfrm"
33
version = "0.3.1"
44
authors = ["Scott Zuk <[email protected]>"]
5-
edition = "2018"
5+
edition = "2021"
66
homepage = "https://github.com/rust-netlink/netlink-packet-xfrm"
77
repository = "https://github.com/rust-netlink/netlink-packet-xfrm"
88
keywords = ["netlink", "linux", "ipsec", "xfrm"]
@@ -11,13 +11,10 @@ readme = "README.md"
1111
description = "netlink xfrm packet types for IPsec"
1212

1313
[dependencies]
14-
anyhow = "1.0.39"
15-
byteorder = "1.4.2"
16-
libc= "0.2.86"
17-
netlink-packet-core = { version = "0.7.0" }
18-
netlink-packet-utils = { version = "0.5.2" }
14+
libc= "0.2.177"
15+
netlink-packet-core = { version = "0.8.1" }
1916

2017
[dev-dependencies]
21-
lazy_static = "1.4.0"
22-
netlink-proto = { version = "0.11.2" }
23-
netlink-sys = { version = "0.8.4" }
18+
lazy_static = "1.5.0"
19+
netlink-proto = { version = "0.12" }
20+
netlink-sys = { version = "0.8.7" }

src/address.rs

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

33
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
44

5-
use netlink_packet_utils::{buffer, traits::*, DecodeError};
5+
use netlink_packet_core::{DecodeError, Emitable, Parseable};
66

77
pub const XFRM_ADDRESS_LEN: usize = 16;
88

src/async_event_id.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
// SPDX-License-Identifier: MIT
22

3-
use anyhow::Context;
4-
53
use core::ops::Range;
64

5+
use netlink_packet_core::{DecodeError, Emitable, ErrorContext, Parseable};
6+
77
use crate::{
88
Address, AddressBuffer, UserSaId, UserSaIdBuffer, XFRM_ADDRESS_LEN,
99
XFRM_USER_SA_ID_LEN,
1010
};
1111

12-
use netlink_packet_utils::{buffer, traits::*, DecodeError};
13-
1412
#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)]
1513
pub struct AsyncEventId {
1614
pub sa_id: UserSaId,

src/buffer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: MIT
22

3-
use anyhow::Context;
3+
use netlink_packet_core::{
4+
DecodeError, ErrorContext, Parseable, ParseableParametrized,
5+
};
46

57
use crate::{
68
constants::*,
@@ -35,8 +37,6 @@ use crate::{
3537
XfrmMessage,
3638
};
3739

38-
use netlink_packet_utils::{traits::*, DecodeError};
39-
4040
pub struct XfrmBuffer<T> {
4141
buffer: T,
4242
}
@@ -61,7 +61,7 @@ impl<'a, T: AsRef<[u8]> + ?Sized> XfrmBuffer<&'a T> {
6161
}
6262
}
6363

64-
impl<'a, T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> XfrmBuffer<&'a mut T> {
64+
impl<T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> XfrmBuffer<&mut T> {
6565
pub fn inner_mut(&mut self) -> &mut [u8] {
6666
self.buffer.as_mut()
6767
}

src/id.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
// SPDX-License-Identifier: MIT
22

3-
use anyhow::Context;
3+
use netlink_packet_core::{DecodeError, Emitable, ErrorContext, Parseable};
44

55
use crate::{Address, AddressBuffer, XFRM_ADDRESS_LEN};
66

7-
use netlink_packet_utils::{buffer, traits::*, DecodeError};
8-
97
#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)]
108
pub struct Id {
119
pub daddr: Address,

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ pub use user_sa_info::*;
7373
pub mod user_spi_info;
7474
pub use user_spi_info::*;
7575

76+
#[macro_use]
77+
extern crate netlink_packet_core;
78+
7679
#[cfg(test)]
7780
mod tests;
7881
#[cfg(test)]

src/lifetime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: MIT
22

3-
use crate::XFRM_INF;
3+
use netlink_packet_core::{DecodeError, Emitable, Parseable};
44

5-
use netlink_packet_utils::{buffer, traits::*, DecodeError};
5+
use crate::XFRM_INF;
66

77
// Lifetime config
88

src/message.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// SPDX-License-Identifier: MIT
22

3+
use netlink_packet_core::{
4+
DecodeError, Emitable, NetlinkDeserializable, NetlinkHeader,
5+
NetlinkPayload, NetlinkSerializable, ParseableParametrized,
6+
};
7+
38
use crate::{
49
constants::*,
510
monitor::{
@@ -20,11 +25,6 @@ use crate::{
2025
XfrmBuffer,
2126
};
2227

23-
use netlink_packet_core::{
24-
NetlinkDeserializable, NetlinkHeader, NetlinkPayload, NetlinkSerializable,
25-
};
26-
use netlink_packet_utils::{traits::*, DecodeError};
27-
2828
#[derive(Debug, PartialEq, Eq, Clone)]
2929
pub enum XfrmMessage {
3030
AddPolicy(PolicyModifyMessage),

src/monitor/acquire/buffer.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
// SPDX-License-Identifier: MIT
22

3-
use crate::XFRM_USER_ACQUIRE_LEN;
3+
use netlink_packet_core::{DecodeError, NlaBuffer, NlasIterator};
44

5-
use netlink_packet_utils::{
6-
buffer,
7-
nla::{NlaBuffer, NlasIterator},
8-
DecodeError,
9-
};
5+
use crate::XFRM_USER_ACQUIRE_LEN;
106

117
pub const MONITOR_ACQUIRE_HEADER_LEN: usize = XFRM_USER_ACQUIRE_LEN;
128

0 commit comments

Comments
 (0)