New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix panic bug in Antrea Policy #2730
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2730 +/- ##
==========================================
+ Coverage 59.50% 65.82% +6.32%
==========================================
Files 285 285
Lines 23020 26389 +3369
==========================================
+ Hits 13697 17371 +3674
+ Misses 7865 7394 -471
- Partials 1458 1624 +166
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
/test-all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nits
pkg/agent/openflow/network_policy.go
Outdated
| @@ -1511,6 +1514,9 @@ func (c *client) updateConjunctionActionFlows(conj *policyRuleConjunction, updat | |||
| func (c *client) updateConjunctionMatchFlows(conj *policyRuleConjunction, newPriority uint16) { | |||
| allClause := []*clause{conj.fromClause, conj.toClause, conj.serviceClause} | |||
| for _, clause := range allClause { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not introduced by your change; but the var clause is used for the struct and for the looping var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, not related just a quick question do we need to check nil before getting flow priority?
func (c *client) GetPolicyInfoFromConjunction(ruleID uint32) (string, string) {
conjunction := c.getPolicyRuleConjunction(ruleID)
priorities := conjunction.ActionFlowPriorities()
if conjunction == nil || len(priorities) == 0 {
return "", ""
}
return conjunction.npRef.ToString(), priorities[0]
}
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just same nits as Abhishek.
Greate catch, I would change it together. |
b456068
to
a89edb4
Compare
|
/test-all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, typo in commit message: nill
Check if the clause pointer is nil before looping the matches. Signed-off-by: wenyingd <wenyingd@vmware.com>
a89edb4
to
de43b1e
Compare
|
/test-all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@tnqn Shall I backport this PR to original releases? |
|
@wenyingd please backport to any release which has this bug, starting with v0.13 |
Check if the clause pointer is nil before looping the matches.
Fixes #2729
Signed-off-by: wenyingd wenyingd@vmware.com