Skip to content

Commit

Permalink
Fixed NetFlow v9 flow data misalignment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
elevendroids committed Feb 6, 2013
1 parent dd95ae2 commit c7e16e1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pfPorts/pfflowd-0.8/files/nf9.h
@@ -1,4 +1,3 @@

#ifndef _NF9_H
# define _NF9_H

Expand Down Expand Up @@ -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)
Expand All @@ -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*/

Expand Down

0 comments on commit c7e16e1

Please sign in to comment.