Skip to content

Commit

Permalink
Merge branch 'main' into fix/382
Browse files Browse the repository at this point in the history
  • Loading branch information
nddq authored May 31, 2024
2 parents a5df68f + 0adf32f commit 4133e7b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gotest.tools v2.2.0+incompatible
gotest.tools/v3 v3.5.1
helm.sh/helm/v3 v3.14.4
helm.sh/helm/v3 v3.15.1
k8s.io/apiextensions-apiserver v0.30.1
k8s.io/cli-runtime v0.30.1
k8s.io/kubectl v0.30.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1092,8 +1092,8 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
helm.sh/helm/v3 v3.14.4 h1:6FSpEfqyDalHq3kUr4gOMThhgY55kXUEjdQoyODYnrM=
helm.sh/helm/v3 v3.14.4/go.mod h1:Tje7LL4gprZpuBNTbG34d1Xn5NmRT3OWfBRwpOSer9I=
helm.sh/helm/v3 v3.15.1 h1:22ztacHz4gMqhXNqCQ9NAg6BFWoRUryNLvnkz6OVyw0=
helm.sh/helm/v3 v3.15.1/go.mod h1:fvfoRcB8UKRUV5jrIfOTaN/pG1TPhuqSb56fjYdTKXg=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY=
Expand Down
9 changes: 5 additions & 4 deletions pkg/utils/flow_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/utils_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
})
}
Expand Down

0 comments on commit 4133e7b

Please sign in to comment.