Skip to content

Commit

Permalink
Merge pull request #635 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
service-proxy: Initial support for calico networking
  • Loading branch information
UltraInstinct14 authored Apr 12, 2024
2 parents e897db8 + aafeb4a commit e870597
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions pkg/loxinet/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ import (
"encoding/json"
"errors"
"fmt"
cmn "github.com/loxilb-io/loxilb/common"
tk "github.com/loxilb-io/loxilib"
"io"
"net"
"strings"

tk "github.com/loxilb-io/loxilib"

cmn "github.com/loxilb-io/loxilb/common"
)

// error codes
Expand Down Expand Up @@ -1023,20 +1021,56 @@ func (p *Port) DP(work DpWorkT) int {
return -1
}

if (work == DpCreate || work == DpRemove) &&
(p.IsLeafPort() == true && p.L2.IsPvid == true) {
if (work == DpCreate || work == DpRemove) && (p.IsLeafPort() == true && p.L2.IsPvid == true) {
if work == DpCreate {
if p.SInfo.BpfLoaded == false {
pWq.LoadEbpf = p.Name
p.SInfo.BpfLoaded = true
} else {
pWq.LoadEbpf = ""
}
if strings.Contains(p.Name, "cali") {
rmWq := new(RouterMacDpWorkQ)
rmWq.Work = work

for i := 0; i < 6; i++ {
rmWq.L2Addr[i] = uint8(p.HInfo.MacAddr[i])
}
rmWq.Status = &p.Sync
rmWq.PortNum = p.PortNo
DpWorkSingle(mh.dp, rmWq)
}
} else if work == DpRemove {
if p.SInfo.BpfLoaded == true {
pWq.LoadEbpf = p.Name
p.SInfo.BpfLoaded = false
}

if strings.Contains(p.Name, "cali") {
zn, _ := mh.zn.Zonefind(p.Zone)
if zn != nil {
match := false
for _, pe := range zn.Ports.portImap {
if pe.Name != p.Name {
if pe.HInfo.MacAddr == p.HInfo.MacAddr {
match = true
break
}
}
}
if !match {
rmWq := new(RouterMacDpWorkQ)
rmWq.Work = work

for i := 0; i < 6; i++ {
rmWq.L2Addr[i] = uint8(p.HInfo.MacAddr[i])
}
rmWq.Status = &p.Sync
rmWq.PortNum = p.PortNo
DpWorkSingle(mh.dp, rmWq)
}
}
}
}
} else {
pWq.LoadEbpf = ""
Expand Down

0 comments on commit e870597

Please sign in to comment.