@@ -87,11 +87,11 @@ static bool process_netflow_v1(NFSample *sample)
8787 memcpy (flow_sample.dst_ip .data (), &nf1_flow->dest_ip , sizeof (uint32_t ));
8888 memcpy (flow_sample.nexthop_ip .data (), &nf1_flow->nexthop_ip , sizeof (uint32_t ));
8989
90- flow_sample.src_port = nf1_flow->src_port ;
91- flow_sample.dst_port = nf1_flow->dest_port ;
90+ flow_sample.src_port = be16toh ( nf1_flow->src_port ) ;
91+ flow_sample.dst_port = be16toh ( nf1_flow->dest_port ) ;
9292
93- flow_sample.flow_start = nf1_flow->flow_start ;
94- flow_sample.flow_finish = nf1_flow->flow_finish ;
93+ flow_sample.flow_start = be32toh ( nf1_flow->flow_start ) ;
94+ flow_sample.flow_finish = be32toh ( nf1_flow->flow_finish ) ;
9595
9696 flow_sample.if_index_in = be16toh (nf1_flow->if_index_in );
9797 flow_sample.if_index_out = be16toh (nf1_flow->if_index_out );
@@ -136,11 +136,11 @@ static bool process_netflow_v5(NFSample *sample)
136136 memcpy (flow_sample.dst_ip .data (), &nf5_flow->dest_ip , sizeof (uint32_t ));
137137 memcpy (flow_sample.nexthop_ip .data (), &nf5_flow->nexthop_ip , sizeof (uint32_t ));
138138
139- flow_sample.src_port = nf5_flow->src_port ;
140- flow_sample.dst_port = nf5_flow->dest_port ;
139+ flow_sample.src_port = be16toh ( nf5_flow->src_port ) ;
140+ flow_sample.dst_port = be16toh ( nf5_flow->dest_port ) ;
141141
142- flow_sample.flow_start = nf5_flow->flow_start ;
143- flow_sample.flow_finish = nf5_flow->flow_finish ;
142+ flow_sample.flow_start = be32toh ( nf5_flow->flow_start ) ;
143+ flow_sample.flow_finish = be32toh ( nf5_flow->flow_finish ) ;
144144
145145 flow_sample.if_index_in = be16toh (nf5_flow->if_index_in );
146146 flow_sample.if_index_out = be16toh (nf5_flow->if_index_out );
@@ -190,11 +190,11 @@ static bool process_netflow_v7(NFSample *sample)
190190 memcpy (flow_sample.dst_ip .data (), &nf7_flow->dest_ip , sizeof (uint32_t ));
191191 memcpy (flow_sample.nexthop_ip .data (), &nf7_flow->nexthop_ip , sizeof (uint32_t ));
192192
193- flow_sample.src_port = nf7_flow->src_port ;
194- flow_sample.dst_port = nf7_flow->dest_port ;
193+ flow_sample.src_port = be16toh ( nf7_flow->src_port ) ;
194+ flow_sample.dst_port = be16toh ( nf7_flow->dest_port ) ;
195195
196- flow_sample.flow_start = nf7_flow->flow_start ;
197- flow_sample.flow_finish = nf7_flow->flow_finish ;
196+ flow_sample.flow_start = be32toh ( nf7_flow->flow_start ) ;
197+ flow_sample.flow_finish = be32toh ( nf7_flow->flow_finish ) ;
198198
199199 flow_sample.if_index_in = be16toh (nf7_flow->if_index_in );
200200 flow_sample.if_index_out = be16toh (nf7_flow->if_index_out );
0 commit comments