Skip to content

Commit 2cd92ec

Browse files
committed
fix: clean ct flow when policy changed
1 parent b2cc125 commit 2cd92ec

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

pkg/agent/datapath/multiBridgeDatapath.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -881,11 +881,6 @@ func (datapathManager *DpManager) AddEveroutePolicyRule(rule *EveroutePolicyRule
881881
return nil
882882
}
883883
log.Infof("Rule already exists. update old rule: {%+v} to new rule: {%+v} ", ruleEntry.EveroutePolicyRule, rule)
884-
885-
// clear CT flow while updating from "allow" to "deny"
886-
if ruleEntry.EveroutePolicyRule.Action == EveroutePolicyAllow && rule.Action == EveroutePolicyDeny {
887-
datapathManager.cleanConntrackFlow(rule)
888-
}
889884
}
890885

891886
log.Infof("Received AddRule: %+v", rule)
@@ -900,10 +895,7 @@ func (datapathManager *DpManager) AddEveroutePolicyRule(rule *EveroutePolicyRule
900895
ruleFlowMap[vdsID] = flowEntry
901896
}
902897

903-
// clean related CT flows only for "deny" action while adding
904-
if rule.Action == EveroutePolicyDeny {
905-
datapathManager.cleanConntrackFlow(rule)
906-
}
898+
datapathManager.cleanConntrackFlow(rule)
907899

908900
// save the rule. ruleFlowMap need deepcopy, NOTE
909901
if ruleEntry == nil {
@@ -920,7 +912,6 @@ func (datapathManager *DpManager) AddEveroutePolicyRule(rule *EveroutePolicyRule
920912
// save flowID reference
921913
for _, v := range ruleEntry.RuleFlowMap {
922914
datapathManager.FlowIDToRules[v.FlowID] = ruleEntry
923-
log.Info(v.FlowID)
924915
}
925916

926917
datapathManager.Rules[rule.RuleID] = ruleEntry
@@ -961,10 +952,7 @@ func (datapathManager *DpManager) RemoveEveroutePolicyRule(ruleID string, ruleNa
961952
delete(datapathManager.FlowIDToRules, pRule.RuleFlowMap[vdsID].FlowID)
962953
}
963954

964-
// clean related CT flows only for "allow" action while deleting
965-
if datapathManager.Rules[ruleID].EveroutePolicyRule.Action == EveroutePolicyAllow {
966-
datapathManager.cleanConntrackFlow(datapathManager.Rules[ruleID].EveroutePolicyRule)
967-
}
955+
datapathManager.cleanConntrackFlow(datapathManager.Rules[ruleID].EveroutePolicyRule)
968956

969957
if pRule.PolicyRuleReference.Len() == 0 {
970958
delete(datapathManager.Rules, ruleID)

0 commit comments

Comments
 (0)