diff options
Diffstat (limited to 'src/vrrpv2.rs')
-rw-r--r-- | src/vrrpv2.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs index 539d67f..9a8fc95 100644 --- a/src/vrrpv2.rs +++ b/src/vrrpv2.rs @@ -38,6 +38,7 @@ pub struct VRRPv2 { pub enum VRRPv2Error { InvalidAuthType, InvalidChecksum, + InvalidTTL, InvalidType, InvalidVersion, ParseError, @@ -48,6 +49,7 @@ impl std::fmt::Display for VRRPv2Error { match self { Self::InvalidAuthType => write!(f, "Invalid Auth Type"), Self::InvalidChecksum => write!(f, "Invalid Checksum"), + Self::InvalidTTL => write!(f, "Invalid TTL"), Self::InvalidType => write!(f, "Invalid Type"), Self::InvalidVersion => write!(f, "Invalid Version"), Self::ParseError => write!(f, "Parse Error"), @@ -120,8 +122,8 @@ impl VRRPv2 { wr.write_all([0; 8].as_ref())?; // Authentication Data let mut bytes = wr.into_inner(); // Calculate the checksum and set the respective bits - let sum = checksum(&bytes); - [bytes[6], bytes[7]] = sum.to_be_bytes(); + let cksum = checksum(&bytes); + [bytes[6], bytes[7]] = cksum.to_be_bytes(); Ok(bytes) } } |