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

gh-48 fullproxy fixes for cicd runs #728

Closed
wants to merge 3 commits into from
Closed
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
12 changes: 6 additions & 6 deletions .github/workflows/advanced-lb-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ jobs:
./validation.sh
./rmconfig.sh
cd -
#- run: |
# cd cicd/httpsproxy/
# ./config.sh
# ./validation.sh
# ./rmconfig.sh
# cd -
- run: |
cd cicd/httpsproxy/
./config.sh
./validation.sh
./rmconfig.sh
cd -
2 changes: 1 addition & 1 deletion api/models/route_get_entry.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions api/restapi/handler/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ package handler

import (
"fmt"
"strings"

"github.com/go-openapi/runtime/middleware"
"github.com/loxilb-io/loxilb/api/loxinlp"
"github.com/loxilb-io/loxilb/api/models"
"github.com/loxilb-io/loxilb/api/restapi/operations"
tk "github.com/loxilb-io/loxilib"
"strconv"
"strings"
)

func ConfigPostRoute(params operations.PostConfigRouteParams) middleware.Responder {
Expand Down Expand Up @@ -58,7 +58,20 @@ func ConfigGetRoute(params operations.GetConfigRouteAllParams) middleware.Respon
tmpResult.Flags = strings.TrimSpace(route.Flags)
tmpResult.Gateway = route.Gw
tmpResult.HardwareMark = int64(route.HardwareMark)
tmpResult.Protocol = int64(route.Protocol)
protoStr := strconv.Itoa(route.Protocol)
switch route.Protocol {
case 0:
protoStr = "unspec"
case 1:
protoStr = "redirect"
case 2:
protoStr = "kernel"
case 3:
protoStr = "boot"
case 4:
protoStr = "static"
}
tmpResult.Protocol = protoStr
tmpResult.Sync = int64(route.Sync)

tmpStats := new(models.RouteGetEntryStatistic)
Expand Down
2 changes: 1 addition & 1 deletion api/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2958,7 +2958,7 @@ definitions:
type: integer
description: index of the route
protocol:
type: integer
type: string
description: Route protocol
flags:
type: string
Expand Down
2 changes: 1 addition & 1 deletion loxilb-ebpf
Submodule loxilb-ebpf updated 1 files
+34 −16 common/sockproxy.c
7 changes: 7 additions & 0 deletions pkg/loxinet/dpebpf_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,16 @@ func DpRouterMacMod(w *RouterMacDpWorkQ) int {
unsafe.Pointer(dat))

if ret != 0 {
if w.Status != nil {
*w.Status = DpCreateErr
}
return EbpfErrTmacAdd
}

if w.Status != nil {
*w.Status = 0
}

return 0
} else if w.Work == DpRemove {

Expand Down
30 changes: 28 additions & 2 deletions pkg/loxinet/layer2.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ func (l2 *L2H) L2FdbAdd(key FdbKey, attr FdbAttr) (int, error) {
p := l2.Zone.Ports.PortFindByName(attr.Oif)
if p == nil || !p.SInfo.PortActive {
tk.LogIt(tk.LogDebug, "fdb port not found %s\n", attr.Oif)
return L2OifErr, errors.New("no such port")
p = l2.Zone.Ports.PortFindByName("lo")
if p == nil {
return L2OifErr, errors.New("no such port")
}
}

fdb, found := l2.FdbMap[key]
Expand Down Expand Up @@ -315,7 +318,19 @@ func (l2 *L2H) FdbTicker(f *FdbEnt) {
// This scans for inconsistencies in a fdb
// 1. Do garbage cleaning if underlying oif or vlan is not valid anymore
// 2. If FDB is a TunFDB, we need to make sure NH is reachable
if f.Port.SInfo.PortActive == false {
if f.Port.Name == "lo" || f.FdbKey.BridgeID != f.Port.L2.Vid {
p := l2.Zone.Ports.PortFindByName(f.FdbAttr.Oif)
if p != nil && p.SInfo.PortActive {
if f.Port.L2.Vid != f.FdbKey.BridgeID {
tk.LogIt(tk.LogDebug, "fdb ent, %v BD mismatch\n", f)
return
}
tk.LogIt(tk.LogDebug, "fdb ent, %v - reset port: %s\n", f, p.Name)
f.Port = p
// Force Resync
f.Sync = DpCreateErr
}
} else if f.Port.SInfo.PortActive == false {
l2.L2FdbDel(f.FdbKey)
} else if f.unReach == true {
tk.LogIt(tk.LogDebug, "unrch scan - %v\n", f)
Expand Down Expand Up @@ -383,10 +398,21 @@ func (l2 *L2H) L2DestructAll() {
// DP - Sync state of L2 entities to data-path
func (f *FdbEnt) DP(work DpWorkT) int {

if f.Port.Name == "lo" {
f.Sync = DpCreateErr
return -1
}

if work == DpCreate && f.unReach == true {
return 0
}

if f.Port.L2.Vid != f.FdbKey.BridgeID {
tk.LogIt(tk.LogDebug, "fdb ent, can't sync %v (%v)\n", f.FdbKey, f.Port.L2.Vid)
f.Sync = DpCreateErr
return -1
}

l2Wq := new(L2AddrDpWorkQ)
l2Wq.Work = work
l2Wq.Status = &f.Sync
Expand Down
26 changes: 26 additions & 0 deletions pkg/loxinet/layer3.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,37 @@ func (l3 *L3H) IfaGet() []cmn.IPAddrGet {
return ret
}

// IfaTicker - Periodic ticker for checking Ifas
func (l3 *L3H) IfasTicker() {
for _, ifa := range l3.IfaMap {
if ifa.Key.Obj == "lo" {
continue
}

canSync := false
for _, ifaEnt := range ifa.Ifas {
canSync = true
if ifaEnt.Secondary {
continue
}
}

if canSync && ifa.Sync != 0 {
tk.LogIt(tk.LogDebug, "defer resync ifa obj : %s\n", ifa.Key.Obj)
ifa.DP(DpCreate)
}
}
}

// DP - Sync state of L3 entities to data-path
func (ifa *Ifa) DP(work DpWorkT) int {
port := ifa.Zone.Ports.PortFindByName(ifa.Key.Obj)

if port == nil {
if ifa.Key.Obj != "lo" {
tk.LogIt(tk.LogError, "No such obj : %s\n", ifa.Key.Obj)
ifa.Sync = DpCreateErr
}
return -1
}

Expand Down
42 changes: 23 additions & 19 deletions pkg/loxinet/neighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,13 @@ func (n *NeighH) NeighAdd(Addr net.IP, Zone string, Attr NeighAttr) (int, error)
zeroHwAddr, _ := net.ParseMAC("00:00:00:00:00:00")
ne, found := n.NeighMap[key]

add2Map := !found

port := n.Zone.Ports.PortFindByOSID(Attr.OSLinkIndex)
if port == nil {
tk.LogIt(tk.LogError, "neigh add - %s:%s no oport\n", Addr.String(), Zone)
if !found {
n.NeighMap[key] = &Neigh{Dummy: true, Attr: Attr, NhRtm: make(map[RtKey]*Rt)}
n.NeighMap[key] = &Neigh{Key: key, Dummy: true, Addr: Addr, Attr: Attr, Inactive: true, NhRtm: make(map[RtKey]*Rt)}
} else {
ne.Dummy = true
ne.OifPort = nil
Expand All @@ -392,14 +394,13 @@ func (n *NeighH) NeighAdd(Addr net.IP, Zone string, Attr NeighAttr) (int, error)
ra := RtAttr{0, 0, true, Attr.OSLinkIndex, false}
na := []RtNhAttr{{Addr, Attr.OSLinkIndex}}

if found == true {
if found {
ne.Inactive = false
ne.Dummy = false
if bytes.Equal(Attr.HardwareAddr, zeroHwAddr) == true {
if bytes.Equal(Attr.HardwareAddr, zeroHwAddr) {
ne.Resolved = false
} else {
if bytes.Equal(Attr.HardwareAddr, ne.Attr.HardwareAddr) == false ||
ne.Resolved == false {
if !bytes.Equal(Attr.HardwareAddr, ne.Attr.HardwareAddr) || !ne.Resolved {
ne.Attr.HardwareAddr = Attr.HardwareAddr
ne.Resolved = true
n.NeighRecursiveResolve(ne)
Expand All @@ -412,30 +413,34 @@ func (n *NeighH) NeighAdd(Addr net.IP, Zone string, Attr NeighAttr) (int, error)
return NeighExistsErr, errors.New("nh exists")
}

idx, err = n.NeighID.GetCounter()
if err != nil {
tk.LogIt(tk.LogError, "neigh add - %s:%s no marks\n", Addr.String(), Zone)
return NeighRangeErr, errors.New("nh-hwm error")
}

if ne == nil {
ne = new(Neigh)
ne.Key = key
}

if ne.Mark == 0 {
idx, err = n.NeighID.GetCounter()
if err != nil {
tk.LogIt(tk.LogError, "neigh add - %s:%s no marks\n", Addr.String(), Zone)
return NeighRangeErr, errors.New("nh-hwm error")
}
ne.Mark = idx
}

ne.Dummy = false
ne.Key = key
ne.Addr = Addr
ne.Attr = Attr
ne.OifPort = port
ne.Mark = idx
ne.Type |= NhNormal
if ne.NhRtm == nil {
ne.NhRtm = make(map[RtKey]*Rt)
}
ne.Inactive = false

n.NeighRecursiveResolve(ne)
n.NeighMap[ne.Key] = ne

if add2Map {
n.NeighMap[ne.Key] = ne
}
ne.DP(DpCreate)

NhExist:
Expand Down Expand Up @@ -485,7 +490,7 @@ func (n *NeighH) NeighDelete(Addr net.IP, Zone string) (int, error) {
key := NeighKey{Addr.String(), Zone}

ne, found := n.NeighMap[key]
if found == false {
if !found {
tk.LogIt(tk.LogError, "neigh delete - %s:%s doesnt exist\n", Addr.String(), Zone)
return NeighNoEntErr, errors.New("no-nh error")
}
Expand Down Expand Up @@ -607,12 +612,12 @@ func (n *NeighH) NeighPairRt(ne *Neigh, rt *Rt) int {
func (n *NeighH) NeighUnPairRt(ne *Neigh, rt *Rt) int {

_, found := ne.NhRtm[rt.Key]
if found == false {
if !found {
return -1
}

delete(ne.NhRtm, rt.Key)
if len(ne.NhRtm) < 1 && ne.Inactive == true {
if len(ne.NhRtm) < 1 && ne.Inactive {
// Safely remove
tk.LogIt(tk.LogDebug, "neigh rt unpair - %s->%s\n", rt.Key.RtCidr, ne.Key.NhString)
n.NeighDelete(ne.Addr, ne.Key.Zone)
Expand Down Expand Up @@ -664,7 +669,6 @@ func (n *NeighH) NeighTicker(ne *Neigh) {

_, err := zone.Nh.NeighAdd(net.ParseIP(ne.Key.NhString), ne.Key.Zone, ne.Attr)
if err == nil {

tk.LogIt(tk.LogInfo, "nh defer added - %s:%s\n", ne.Key.NhString, ne.Key.Zone)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/loxinet/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (r *RtH) RtAdd(Dst net.IPNet, Zone string, Ra RtAttr, Na []RtNhAttr) (int,

rt.DP(DpCreate)

tk.LogIt(tk.LogDebug, "rt added - %s:%s\n", Dst.String(), Zone)
tk.LogIt(tk.LogDebug, "rt added - %s:%s mark:%v\n", Dst.String(), Zone, rt.RtGetNhMark())

return 0, nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/loxinet/zones.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,6 @@ func (z *ZoneH) ZoneTicker() {
zone.Sess.SessionTicker()
zone.Pols.PolTicker()
zone.Mirrs.MirrTicker()
zone.L3.IfasTicker()
}
}
Loading