From 99d0169fba7fc1804a221a0b9dbaeef10f4dd807 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Thu, 8 Feb 2024 13:27:01 +0900 Subject: [PATCH] Fixed to remove rule VIP on state changes --- loxinet/rules.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/loxinet/rules.go b/loxinet/rules.go index 2ca316a0..7c23e4b2 100644 --- a/loxinet/rules.go +++ b/loxinet/rules.go @@ -1507,7 +1507,7 @@ func (R *RuleH) DeleteNatLbRule(serv cmn.LbServiceArg) (int, error) { } dev := fmt.Sprintf("llb-rule-%s", sNetAddr.IP.String()) ret, _ := mh.zr.L3.IfaFind(dev, sNetAddr.IP) - if ret != 0 { + if ret == 0 { mh.zr.L3.IfaDelete(dev, sNetAddr.IP.String()+"/32") } delete(R.vipMap, sNetAddr.IP.String()) @@ -2539,6 +2539,11 @@ func (r *ruleEnt) DP(work DpWorkT) int { func (R *RuleH) AdvRuleVIPIfL2(IP net.IP) error { ciState, _ := mh.has.CIStateGetInst(cmn.CIDefault) if ciState == "MASTER" { + dev := fmt.Sprintf("llb-rule-%s", IP.String()) + ret, _ := mh.zr.L3.IfaFind(dev, IP) + if ret == 0 { + mh.zr.L3.IfaDelete(dev, IP.String()+"/32") + } ev, _, iface := R.zone.L3.IfaSelectAny(IP, false) if ev == 0 { if !IsIPHostAddr(IP.String()) {