diff --git a/api/loxinlp/nlp.go b/api/loxinlp/nlp.go index 40294741e..b56d66f08 100644 --- a/api/loxinlp/nlp.go +++ b/api/loxinlp/nlp.go @@ -19,6 +19,10 @@ import ( "encoding/json" "errors" "fmt" + cmn "github.com/loxilb-io/loxilb/common" + tk "github.com/loxilb-io/loxilib" + nlp "github.com/vishvananda/netlink" + "golang.org/x/sys/unix" "net" "os" "os/exec" @@ -27,12 +31,6 @@ import ( "strings" "syscall" "time" - - tk "github.com/loxilb-io/loxilib" - nlp "github.com/vishvananda/netlink" - "golang.org/x/sys/unix" - - cmn "github.com/loxilb-io/loxilb/common" ) const ( @@ -368,12 +366,21 @@ func AddNeighNoHook(address, ifName, macAddress string) int { func DelNeighNoHook(address, ifName string) int { var ret int + Address := net.ParseIP(address) IfName, err := nlp.LinkByName(ifName) if err != nil { - tk.LogIt(tk.LogWarning, "[NLP] Port %s find Fail\n", ifName) - return -1 + nList, err1 := nlp.NeighList(0, 0) + if err1 != nil { + tk.LogIt(tk.LogWarning, "[NLP] Neighbor List get Failed\n") + return -1 + } + for _, n := range nList { + if n.IP.String() == address { + nlp.NeighDel(&n) + } + } + return 0 } - Address := net.ParseIP(address) // Make Neigh neigh := nlp.Neigh{ diff --git a/loxilb-ebpf b/loxilb-ebpf index 6e5c76583..6dc332ec3 160000 --- a/loxilb-ebpf +++ b/loxilb-ebpf @@ -1 +1 @@ -Subproject commit 6e5c76583ec61a29a43e48e461f8a31ce7492de9 +Subproject commit 6dc332ec34dd42ec8521c6825355c1ab9e4d8ed4 diff --git a/loxinet/rules.go b/loxinet/rules.go index 538828876..ca68888a6 100644 --- a/loxinet/rules.go +++ b/loxinet/rules.go @@ -2540,6 +2540,7 @@ func (R *RuleH) AdvRuleVIPIfL2(IP net.IP) error { } else { tk.LogIt(tk.LogInfo, "nat lb-rule vip %s:%s added\n", IP.String(), "lo") } + loxinlp.DelNeighNoHook(IP.String(), "") } ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) defer cancel()