Skip to content

Commit

Permalink
Merge pull request #498 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
PR : gh-494 Fixes for ipvs-compat mode
  • Loading branch information
UltraInstinct14 authored Jan 19, 2024
2 parents 9550131 + c998762 commit c458b44
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
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

0 comments on commit c458b44

Please sign in to comment.