Skip to content

Commit

Permalink
Dumping OVS flows of a NetworkPolicy
Browse files Browse the repository at this point in the history
Fixes #3306.

This commit fixes the nil pointer dereferrence error while dumping the ovsflows of NetworkPolicy.

Signed-off-by: Pulkit Jain <jainpu@vmware.com>
  • Loading branch information
Pulkit Jain committed Feb 21, 2022
1 parent 3f30d84 commit 7a0ceba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/agent/openflow/network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,11 @@ func (c *client) GetNetworkPolicyFlowKeys(npName, npNamespace string) []string {

for _, conjObj := range c.policyCache.List() {
conj := conjObj.(*policyRuleConjunction)
// If the NetworkPolicyReference in the policyRuleConjunction is nil then that entry in client's
// policyCache should be ignored because here we need to dump flows of NetworkPolicy.
if conj.npRef == nil {
continue
}
if conj.npRef.Name == npName && conj.npRef.Namespace == npNamespace {
// There can be duplicated flows added due to conjunctive matches
// shared by multiple policy rules (clauses).
Expand Down

0 comments on commit 7a0ceba

Please sign in to comment.