@@ -728,6 +728,7 @@ That would allow everything to stay on the stack as it does here, which has nice
728728 SFLFlow_sample_element fnElem = { .tag = SFLFLOW_EX_FUNCTION };
729729 SFLFlow_sample_element hwElem = { .tag = SFLFLOW_EX_HW_TRAP };
730730 SFLFlow_sample_element rnElem = { .tag = SFLFLOW_EX_LINUX_REASON };
731+ SFLFlow_sample_element tsElem = { .tag = SFLFLOW_EX_TIMESTAMP };
731732
732733 // and some parameters to pick up for cross-check below
733734 uint32_t trunc_len = 0 ;
@@ -737,6 +738,7 @@ That would allow everything to stay on the stack as it does here, which has nice
737738 char * hw_name = NULL ;
738739 char * sw_symbol = NULL ;
739740 char * reason = NULL ;
741+ uint64_t timestamp_nS = 0 ;
740742
741743 // increment counter for threshold check
742744 mdata -> totalDrops_thisTick ++ ;
@@ -793,7 +795,8 @@ That would allow everything to stay on the stack as it does here, which has nice
793795 }
794796 break ;
795797 case NET_DM_ATTR_TIMESTAMP :
796- EVDebug (mod , 4 , "u64=TIMESTAMP=%" PRIu64 , * (uint64_t * )datap );
798+ timestamp_nS = * (uint64_t * )datap ;
799+ EVDebug (mod , 4 , "u64=TIMESTAMP=%" PRIu64 , timestamp_nS );
797800 break ;
798801 case NET_DM_ATTR_PROTO :
799802 skb_protocol = * (uint16_t * )datap ;
@@ -957,7 +960,10 @@ That would allow everything to stay on the stack as it does here, which has nice
957960 rnElem .flowType .linux_reason .reason .len = my_strlen (reason );
958961 SFLADD_ELEMENT (& discard , & rnElem );
959962 }
960-
963+ if (timestamp_nS ) {
964+ tsElem .flowType .timestamp .nanoseconds = timestamp_nS ;
965+ SFLADD_ELEMENT (& discard , & tsElem );
966+ }
961967 HSPPendingEvtSample es = { .notifier = notifier , .discard = & discard };
962968 if (mdata -> evt_intf_es )
963969 EVEventTx (mod , mdata -> evt_intf_es , & es , sizeof (es ));
0 commit comments