Skip to content

Commit baed9af

Browse files
little-dudecathay4t
authored andcommitted
add test for link with IFLA_VRF_PORT_TABLE attribute
Note that I had to derive `Default` on a couple structs to make the test manageable. Also, I noticed that the packet we emit does not 100% matches the packet emitted by the kernel.
1 parent abfadc1 commit baed9af

File tree

10 files changed

+325
-13
lines changed

10 files changed

+325
-13
lines changed

Diff for: src/link/af_spec/inet.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ buffer!(InetDevConfBuffer(DEV_CONF_LEN) {
123123
arp_evict_nocarrier: (i32, 128..132),
124124
});
125125

126-
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
126+
#[derive(Clone, Copy, Eq, PartialEq, Debug, Default)]
127127
#[non_exhaustive]
128128
pub struct InetDevConf {
129129
pub forwarding: i32,

Diff for: src/link/af_spec/inet6_devconf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl Emitable for Inet6DevConf {
216216
}
217217
}
218218

219-
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
219+
#[derive(Clone, Copy, Eq, PartialEq, Debug, Default)]
220220
#[non_exhaustive]
221221
pub struct Inet6DevConf {
222222
pub forwarding: i32,

Diff for: src/link/af_spec/inet6_icmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use netlink_packet_utils::{
77

88
pub(crate) const ICMP6_STATS_LEN: usize = 48;
99

10-
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
10+
#[derive(Clone, Copy, Eq, PartialEq, Debug, Default)]
1111
#[non_exhaustive]
1212
pub struct Icmp6Stats {
1313
pub num: i64,

Diff for: src/link/af_spec/inet6_stats.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ buffer!(Inet6StatsBuffer(INET6_STATS_LEN) {
4646
in_ce_pkts: (i64, 280..288),
4747
});
4848

49-
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
49+
#[derive(Clone, Copy, Eq, PartialEq, Debug, Default)]
5050
#[non_exhaustive]
5151
pub struct Inet6Stats {
5252
pub num: i64,

Diff for: src/link/link_info/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub use self::gre_tap6::InfoGreTap6;
4242
pub use self::gtp::InfoGtp;
4343
pub use self::hsr::{HsrProtocol, InfoHsr};
4444
pub use self::info_data::InfoData;
45-
pub use self::info_port::{InfoPortData, InfoPortKind};
45+
pub use self::info_port::{InfoPortData, InfoPortKind, InfoVrfPort};
4646
pub use self::infos::{InfoKind, LinkInfo};
4747
pub use self::ipoib::InfoIpoib;
4848
pub use self::ipvlan::{InfoIpVlan, InfoIpVtap, IpVlanMode, IpVtapMode};

Diff for: src/link/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ buffer!(MapBuffer(LINK_MAP_LEN) {
1616
port: (u8, 27),
1717
});
1818

19-
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
19+
#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)]
2020
#[non_exhaustive]
2121
pub struct Map {
2222
pub memory_start: u64,

Diff for: src/link/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ pub use self::link_info::{
4444
InfoGreTap, InfoGreTap6, InfoGreTun, InfoGreTun6, InfoGtp, InfoHsr,
4545
InfoIpVlan, InfoIpVtap, InfoIpoib, InfoKind, InfoMacSec, InfoMacVlan,
4646
InfoMacVtap, InfoPortData, InfoPortKind, InfoSitTun, InfoTun, InfoVeth,
47-
InfoVlan, InfoVrf, InfoVti, InfoVxlan, InfoXfrm, IpVlanMode, IpVtapMode,
48-
LinkInfo, LinkXstats, MacSecCipherId, MacSecOffload, MacSecValidate,
49-
MacVlanMode, MacVtapMode, MiiStatus, VlanQosMapping,
47+
InfoVlan, InfoVrf, InfoVrfPort, InfoVti, InfoVxlan, InfoXfrm, IpVlanMode,
48+
IpVtapMode, LinkInfo, LinkXstats, MacSecCipherId, MacSecOffload,
49+
MacSecValidate, MacVlanMode, MacVtapMode, MiiStatus, VlanQosMapping,
5050
};
5151
pub use self::link_layer_type::LinkLayerType;
5252
pub use self::link_state::State;

Diff for: src/link/stats.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use netlink_packet_utils::{
77

88
pub(crate) const LINK_STATS_LEN: usize = 96;
99

10-
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
10+
#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)]
1111
#[non_exhaustive]
1212
pub struct Stats {
1313
/// total packets received

Diff for: src/link/stats64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ buffer!(Stats64Buffer(LINK_STATS64_LEN) {
3535
rx_otherhost_dropped: (u64, 192..200),
3636
});
3737

38-
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
38+
#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)]
3939
#[non_exhaustive]
4040
pub struct Stats64 {
4141
/// total packets received

Diff for: src/link/tests/vrf.rs

+314-2
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)