From e145292439a00ee598085bf7700b6f5e1635ca6c Mon Sep 17 00:00:00 2001 From: bebecue <109153518+bebecue@users.noreply.github.com> Date: Sat, 21 Sep 2024 11:47:08 +0800 Subject: [PATCH] Add ICMP6_MIB_RATELIMITHOST Signed-off-by: bebecue <109153518+bebecue@users.noreply.github.com> --- src/link/af_spec/inet6_icmp.rs | 6 +++++- src/link/tests/statistics.rs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/link/af_spec/inet6_icmp.rs b/src/link/af_spec/inet6_icmp.rs index dc2918eb..bbd963a8 100644 --- a/src/link/af_spec/inet6_icmp.rs +++ b/src/link/af_spec/inet6_icmp.rs @@ -5,7 +5,7 @@ use netlink_packet_utils::{ DecodeError, }; -pub(crate) const ICMP6_STATS_LEN: usize = 48; +pub(crate) const ICMP6_STATS_LEN: usize = 56; #[derive(Clone, Copy, Eq, PartialEq, Debug, Default)] #[non_exhaustive] @@ -16,6 +16,7 @@ pub struct Icmp6Stats { pub out_msgs: i64, pub out_errors: i64, pub csum_errors: i64, + pub rate_limit_host: i64, } buffer!(Icmp6StatsBuffer(ICMP6_STATS_LEN) { @@ -25,6 +26,7 @@ buffer!(Icmp6StatsBuffer(ICMP6_STATS_LEN) { out_msgs: (i64, 24..32), out_errors: (i64, 32..40), csum_errors: (i64, 40..48), + rate_limit_host: (i64, 48..56), }); impl> Parseable> for Icmp6Stats { @@ -36,6 +38,7 @@ impl> Parseable> for Icmp6Stats { out_msgs: buf.out_msgs(), out_errors: buf.out_errors(), csum_errors: buf.csum_errors(), + rate_limit_host: buf.rate_limit_host(), }) } } @@ -53,5 +56,6 @@ impl Emitable for Icmp6Stats { buffer.set_out_msgs(self.out_msgs); buffer.set_out_errors(self.out_errors); buffer.set_csum_errors(self.csum_errors); + buffer.set_rate_limit_host(self.rate_limit_host); } } diff --git a/src/link/tests/statistics.rs b/src/link/tests/statistics.rs index 08f2078b..4e49de10 100644 --- a/src/link/tests/statistics.rs +++ b/src/link/tests/statistics.rs @@ -378,6 +378,7 @@ fn test_parsing_link_statistics_on_kernel_4_18() { out_msgs: 6, out_errors: 0, csum_errors: 0, + rate_limit_host: 0, }), AfSpecInet6::Token(std::net::Ipv6Addr::UNSPECIFIED), AfSpecInet6::AddrGenMode(1),