diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vrrpv2.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs index 7e4a6cd..18011f1 100644 --- a/src/vrrpv2.rs +++ b/src/vrrpv2.rs @@ -86,8 +86,6 @@ impl VRRPv2 { pub fn to_bytes(&self) -> Result<Vec<u8>, std::io::Error> { let sz = MIN_PACKET_SIZE + (self.ip_addrs.len() * 4); let mut bytes: Vec<u8> = Vec::with_capacity(sz); - - // Write header bytes.push(VERSION_TYPE); bytes.push(self.virtual_router_id); bytes.push(self.priority); @@ -95,16 +93,10 @@ impl VRRPv2 { bytes.push(self.auth_type as u8); bytes.push(self.advertisement_interval); bytes.extend_from_slice(&[0, 0]); // Placeholder for checksum - - // Write IP addresses for ip in &self.ip_addrs { bytes.extend_from_slice(&ip.to_bits().to_be_bytes()); } - - // Write auth data - bytes.extend_from_slice(&[0; 8]); - - // Calculate and set checksum + bytes.extend_from_slice(&[0; 8]); // auth data let cksum = checksum(&bytes); let cksum_bytes = cksum.to_be_bytes(); bytes[6] = cksum_bytes[0]; |