summaryrefslogtreecommitdiff
path: root/src/vrrpv2.rs
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2025-09-11 09:47:46 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2025-09-11 09:47:46 +0530
commit89c0f1cdfe4e5e3742623d8e119aaadda21cb12f (patch)
tree1c19e20f2004fa68fc811470f1df955f61bc602c /src/vrrpv2.rs
parent622e7f3b87427d1857bf2cedb6e81abb48d2ba60 (diff)
Remove obvious comments.
Diffstat (limited to 'src/vrrpv2.rs')
-rw-r--r--src/vrrpv2.rs10
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];