diff --git a/pkg/utils/flow_utils.go b/pkg/utils/flow_utils.go index 2c43d438ab5..bb8c1038488 100644 --- a/pkg/utils/flow_utils.go +++ b/pkg/utils/flow_utils.go @@ -266,10 +266,6 @@ func AddDropReason(f *flow.Flow, meta *RetinaMetadata, dropReason uint32) { meta.DropReason = DropReason(dropReason) f.Verdict = flow.Verdict_DROPPED - f.EventType = &flow.CiliumEventType{ - Type: int32(api.MessageTypeDrop), - SubType: int32(api.TraceToNetwork), // This is a drop event and direction is determined later. - } // Set the drop reason. // Retina drop reasons are different from the drop reasons available in flow library. @@ -285,6 +281,11 @@ func AddDropReason(f *flow.Flow, meta *RetinaMetadata, dropReason uint32) { default: f.DropReasonDesc = flow.DropReason_DROP_REASON_UNKNOWN } + + f.EventType = &flow.CiliumEventType{ + Type: int32(api.MessageTypeDrop), + SubType: int32(f.GetDropReasonDesc()), // This is the drop reason. + } } func DropReasonDescription(f *flow.Flow) string { diff --git a/pkg/utils/utils_linux_test.go b/pkg/utils/utils_linux_test.go index 0a0f5477809..520a30d5338 100644 --- a/pkg/utils/utils_linux_test.go +++ b/pkg/utils/utils_linux_test.go @@ -158,6 +158,7 @@ func TestAddDropReason(t *testing.T) { assert.Equal(t, f.DropReasonDesc, tc.expectedDesc) assert.Equal(t, f.Verdict, flow.Verdict_DROPPED) assert.NotNil(t, f.EventType.Type, 1) + assert.EqualValues(t, f.EventType.GetSubType(), int32(tc.expectedDesc)) assert.NotNil(t, DropReasonDescription(f), DropReason_name[int32(tc.dropReason)]) }) }