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));