Skip to content

Commit 9bf0a79

Browse files
authored
fix filter icmp pointer check (netobserv#755)
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com> (cherry picked from commit 6faff0a)
1 parent 5219a48 commit 9bf0a79

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

controllers/ebpf/agent_controller.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -482,28 +482,19 @@ func (c *AgentController) configureFlowFilter(filter *flowslatest.EBPFFlowFilter
482482
Value: strconv.Itoa(filter.Ports.IntValue()),
483483
})
484484
}
485-
if *filter.ICMPType != 0 {
485+
if filter.ICMPType != nil && *filter.ICMPType != 0 {
486486
config = append(config, corev1.EnvVar{Name: envFilterICMPType,
487487
Value: strconv.Itoa(*filter.ICMPType),
488488
})
489489
}
490-
if *filter.ICMPCode != 0 {
490+
if filter.ICMPCode != nil && *filter.ICMPCode != 0 {
491491
config = append(config, corev1.EnvVar{Name: envFilterICMPCode,
492492
Value: strconv.Itoa(*filter.ICMPCode)})
493493
}
494494
if filter.PeerIP != "" {
495495
config = append(config, corev1.EnvVar{Name: envFilterPeerIPAddress,
496496
Value: filter.PeerIP})
497497
}
498-
if *filter.ICMPType != 0 {
499-
config = append(config, corev1.EnvVar{Name: envFilterICMPType,
500-
Value: strconv.Itoa(*filter.ICMPType),
501-
})
502-
}
503-
if *filter.ICMPCode != 0 {
504-
config = append(config, corev1.EnvVar{Name: envFilterICMPCode,
505-
Value: strconv.Itoa(*filter.ICMPCode)})
506-
}
507498
return config
508499
}
509500

0 commit comments

Comments
 (0)