From 9bf0a7903ddd37ffc8be4a2ccbd96ad377774d7f Mon Sep 17 00:00:00 2001 From: "Mohamed S. Mahmoud" Date: Tue, 3 Sep 2024 17:35:53 -0400 Subject: [PATCH] fix filter icmp pointer check (#755) Signed-off-by: Mohamed Mahmoud (cherry picked from commit 6faff0a419c930bf0d32ac3eaef25f9f5ca9ba80) --- controllers/ebpf/agent_controller.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/controllers/ebpf/agent_controller.go b/controllers/ebpf/agent_controller.go index a5aa0086d..d47bad3e6 100644 --- a/controllers/ebpf/agent_controller.go +++ b/controllers/ebpf/agent_controller.go @@ -482,12 +482,12 @@ func (c *AgentController) configureFlowFilter(filter *flowslatest.EBPFFlowFilter Value: strconv.Itoa(filter.Ports.IntValue()), }) } - if *filter.ICMPType != 0 { + if filter.ICMPType != nil && *filter.ICMPType != 0 { config = append(config, corev1.EnvVar{Name: envFilterICMPType, Value: strconv.Itoa(*filter.ICMPType), }) } - if *filter.ICMPCode != 0 { + if filter.ICMPCode != nil && *filter.ICMPCode != 0 { config = append(config, corev1.EnvVar{Name: envFilterICMPCode, Value: strconv.Itoa(*filter.ICMPCode)}) } @@ -495,15 +495,6 @@ func (c *AgentController) configureFlowFilter(filter *flowslatest.EBPFFlowFilter config = append(config, corev1.EnvVar{Name: envFilterPeerIPAddress, Value: filter.PeerIP}) } - if *filter.ICMPType != 0 { - config = append(config, corev1.EnvVar{Name: envFilterICMPType, - Value: strconv.Itoa(*filter.ICMPType), - }) - } - if *filter.ICMPCode != 0 { - config = append(config, corev1.EnvVar{Name: envFilterICMPCode, - Value: strconv.Itoa(*filter.ICMPCode)}) - } return config }