@@ -302,20 +302,33 @@ fn parse_netflow(
302302
303303 for flow_set in & parsed. flow_sets {
304304 for record in & flow_set. records {
305- if let V9Record :: Data ( data_record) = record {
306- if let Some ( rate) = extract_v9_sampling_rate ( data_record) {
307- sampling_cache. set ( cache_key, rate) ;
305+ match record {
306+ V9Record :: OptionsData ( data_record) => {
307+ if let Some ( rate) =
308+ extract_v9_sampling_rate ( data_record)
309+ {
310+ sampling_cache. set ( cache_key, rate) ;
311+ }
308312 }
309-
310- let ctx = NetFlowV9Context {
311- header : & parsed. header ,
312- sampler_address : Some ( src) ,
313- sampling_rate : sampling_cache. get ( & cache_key) ,
314- } ;
315- let mut common_flow = ctx. convert ( data_record, flow_set. id ) ;
316- common_flow. time_received_ns = time_received_ns;
317- let enriched = enrichment. enrich ( & common_flow) ;
318- output. write_enriched_flow ( & common_flow, & enriched) ;
313+ V9Record :: Data ( data_record) => {
314+ if let Some ( rate) =
315+ extract_v9_sampling_rate ( data_record)
316+ {
317+ sampling_cache. set ( cache_key, rate) ;
318+ }
319+
320+ let ctx = NetFlowV9Context {
321+ header : & parsed. header ,
322+ sampler_address : Some ( src) ,
323+ sampling_rate : sampling_cache. get ( & cache_key) ,
324+ } ;
325+ let mut common_flow =
326+ ctx. convert ( data_record, flow_set. id ) ;
327+ common_flow. time_received_ns = time_received_ns;
328+ let enriched = enrichment. enrich ( & common_flow) ;
329+ output. write_enriched_flow ( & common_flow, & enriched) ;
330+ }
331+ _ => { }
319332 }
320333 }
321334 }
@@ -361,21 +374,32 @@ fn parse_netflow(
361374
362375 for set in & parsed. sets {
363376 for record in & set. records {
364- if let IpfixRecord :: Data ( data_record) = record {
365- if let Some ( rate) = extract_ipfix_sampling_rate ( data_record)
366- {
367- sampling_cache. set ( cache_key, rate) ;
377+ match record {
378+ IpfixRecord :: OptionsData ( data_record) => {
379+ if let Some ( rate) =
380+ extract_ipfix_sampling_rate ( data_record)
381+ {
382+ sampling_cache. set ( cache_key, rate) ;
383+ }
368384 }
369-
370- let ctx = IpfixContext {
371- header : & parsed. header ,
372- sampler_address : Some ( src) ,
373- sampling_rate : sampling_cache. get ( & cache_key) ,
374- } ;
375- let mut common_flow = ctx. convert ( data_record, set. id ) ;
376- common_flow. time_received_ns = time_received_ns;
377- let enriched = enrichment. enrich ( & common_flow) ;
378- output. write_enriched_flow ( & common_flow, & enriched) ;
385+ IpfixRecord :: Data ( data_record) => {
386+ if let Some ( rate) =
387+ extract_ipfix_sampling_rate ( data_record)
388+ {
389+ sampling_cache. set ( cache_key, rate) ;
390+ }
391+
392+ let ctx = IpfixContext {
393+ header : & parsed. header ,
394+ sampler_address : Some ( src) ,
395+ sampling_rate : sampling_cache. get ( & cache_key) ,
396+ } ;
397+ let mut common_flow = ctx. convert ( data_record, set. id ) ;
398+ common_flow. time_received_ns = time_received_ns;
399+ let enriched = enrichment. enrich ( & common_flow) ;
400+ output. write_enriched_flow ( & common_flow, & enriched) ;
401+ }
402+ _ => { }
379403 }
380404 }
381405 }
0 commit comments