diff options
author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2025-07-01 11:54:57 +0530 |
---|---|---|
committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2025-07-01 11:54:57 +0530 |
commit | 97b4d5e66561724756527973e3675fd76ea6b5a6 (patch) | |
tree | 259aea383da568837f167ac15c1fcffeaabdd25e | |
parent | 102c0555bac8449263af1ecff40d32acba436f67 (diff) |
Derive count_ip_addrs from ip_addrs vec as needed.
Remove explicit storage of count_ip_addrs as it could be derived from
ip_addrs.len() on demand.
-rw-r--r-- | src/vrrpv2.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs index 2277dd2..3613d9b 100644 --- a/src/vrrpv2.rs +++ b/src/vrrpv2.rs @@ -27,7 +27,6 @@ use std::net::Ipv4Addr; pub struct VRRPv2 { pub virtual_router_id: u8, pub priority: u8, - pub count_ip_addrs: u8, pub auth_type: VRRPv2AuthType, pub advertisement_interval: u8, pub checksum: u16, @@ -108,7 +107,7 @@ impl VRRPv2 { 0x21, self.virtual_router_id, self.priority, - self.count_ip_addrs, + self.ip_addrs.len() as u8, self.auth_type as u8, self.advertisement_interval, 0x0, // checksum bits @@ -155,7 +154,6 @@ fn parse(bytes: &[u8]) -> Result<VRRPv2, VRRPv2Error> { Ok(VRRPv2 { virtual_router_id, priority, - count_ip_addrs, auth_type, advertisement_interval, checksum, @@ -181,7 +179,6 @@ fn parse(bytes: &[u8]) -> Result<VRRPv2, VRRPv2Error> { /// let expected = VRRPv2 { /// virtual_router_id: 1, /// priority: 100, -/// count_ip_addrs: 1, /// auth_type: VRRPv2AuthType::VRRPv2AuthNoAuth, /// checksum: 47698, /// advertisement_interval: 1, |