Skip to content

Commit

Permalink
fix filter icmp pointer check (#755)
Browse files Browse the repository at this point in the history
Signed-off-by: Mohamed Mahmoud <[email protected]>
(cherry picked from commit 6faff0a)
  • Loading branch information
msherif1234 authored Sep 3, 2024
1 parent 5219a48 commit 9bf0a79
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions controllers/ebpf/agent_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,28 +482,19 @@ 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)})
}
if filter.PeerIP != "" {
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
}

Expand Down

0 comments on commit 9bf0a79

Please sign in to comment.