Skip to content
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

PR : gh-494 Fixes for ipvs-compat mode #498

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions api/loxinlp/nlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 (
Expand Down Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion loxilb-ebpf
1 change: 1 addition & 0 deletions loxinet/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading