From c7e16e1b59126975f92013dce695477703ca25b1 Mon Sep 17 00:00:00 2001 From: Michal Potrzebicz Date: Thu, 7 Feb 2013 00:33:16 +0100 Subject: [PATCH] Fixed NetFlow v9 flow data misalignment NetFlow v9 flow data has to be aligned on a 32 bit boundary by inserting padding at the end of the flowset. In pfSense 2.0, every even flow in a NetFlow v9 flowset is shifted by two bytes. Those extra bytes are added by the compiler, which aligns NF9_IPV4_DATA on a 4-byte boundary (42 bytes -> 44 bytes) Adding "packed" attribute fixed this issue. Verified using Wireshark and Plixer Scrutinizer. --- pfPorts/pfflowd-0.8/files/nf9.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pfPorts/pfflowd-0.8/files/nf9.h b/pfPorts/pfflowd-0.8/files/nf9.h index c8ee3c370..6f7b1662d 100644 --- a/pfPorts/pfflowd-0.8/files/nf9.h +++ b/pfPorts/pfflowd-0.8/files/nf9.h @@ -1,4 +1,3 @@ - #ifndef _NF9_H # define _NF9_H @@ -184,7 +183,7 @@ struct NF9_IPV4_DATA u_int16_t src_port, dst_port; u_int16_t src_index, dst_index; u_int8_t protocol, direction; -}; +} __attribute__ ((packed)); /* * Data Record for Internet Protocol version 6 (IPv6) @@ -200,7 +199,7 @@ struct NF9_IPV6_DATA u_int16_t src_index, dst_index; u_int8_t protocol, direction; -}; +} __attribute__ ((packed)); /*Ethernet MTU is 1500, IPv6 header is 40 octets(no options) ,UDP header is 8 octets*/