From 5324ab1188fd6d2c617cd6551099b747a3c816cf Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 25 Oct 2019 23:31:53 -0700 Subject: [PATCH] properly set the size in no_flag packets --- psopacket/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psopacket/src/lib.rs b/psopacket/src/lib.rs index f9ed7a4..fc050d2 100644 --- a/psopacket/src/lib.rs +++ b/psopacket/src/lib.rs @@ -177,7 +177,7 @@ fn generate_psopacket_impl(pkt_cmd: u16, name: syn::Ident, attrs: &Vec buf.push(0); } - let pkt_len = (buf.len() + 8) as u16; + let pkt_len = (buf.len() + if #include_flag { 8 } else { 4 }) as u16; let mut prebuf: Vec = Vec::new(); prebuf.extend_from_slice(&u16::to_le_bytes(pkt_len));