Skip to content

Commit

Permalink
loxilb-iogh-219 Continued implementation - Introduced tunnel type for…
Browse files Browse the repository at this point in the history
… better handling of recursive neighbors
  • Loading branch information
PacketCrunch committed Feb 8, 2023
1 parent 17b734f commit 70eb25a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
14 changes: 11 additions & 3 deletions api/loxinlp/nlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,8 @@ func ModLink(link nlp.Link, add bool) int {
real := ""
pType := cmn.PortReal
tunId := 0
tunSrc := net.IP{0, 0, 0, 0}
tunDst := net.IP{0, 0, 0, 0}
tunSrc := net.IPv4zero
tunDst := net.IPv4zero

if strings.Contains(name, "ipsec") || strings.Contains(name, "vti") {
pType = cmn.PortVti
Expand All @@ -809,9 +809,17 @@ func ModLink(link nlp.Link, add bool) int {
tk.LogIt(tk.LogInfo, "[NLP] Bond %v, %s\n", name, mod)
} else if iptun, ok := link.(*nlp.Iptun); ok {
pType = cmn.PortIPTun
if iptun.Remote == nil || iptun.Local == nil {
return -1
}

if iptun.Remote.IsUnspecified() || iptun.Local.IsUnspecified() {
return -1
}
tunId = 1 // Just needed internally
tunDst = iptun.Remote
tunSrc = iptun.Local
tk.LogIt(tk.LogInfo, "[NLP] IPTun %v, %s\n", name, mod)
tk.LogIt(tk.LogInfo, "[NLP] IPTun %v (%s:%s), %s\n", name, tunSrc.String(), tunDst.String(), mod)
} else if master != "" {
pType = cmn.PortBondSif
}
Expand Down
1 change: 1 addition & 0 deletions loxinet/dpbroker.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ type NextHopDpWorkQ struct {
Status *DpStatusT
TunNh bool
TunID uint32
TunType DpTunT
RIP net.IP
SIP net.IP
NNextHopNum int
Expand Down
6 changes: 3 additions & 3 deletions loxinet/dpebpf_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,10 @@ func DpNextHopMod(w *NextHopDpWorkQ) int {
} else {
if w.TunNh {
tk.LogIt(tk.LogDebug, "Setting tunNh 0x%x\n", key.nh_num)
if w.TunID != 0 {
dat.ca.act_type = C.DP_SET_NEIGH_VXLAN
} else {
if w.TunType == DpTunIPIP {
dat.ca.act_type = C.DP_SET_NEIGH_IPIP
} else {
dat.ca.act_type = C.DP_SET_NEIGH_VXLAN
}
tunAct = (*rtTunNhAct)(getPtrOffset(unsafe.Pointer(dat),
C.sizeof_struct_dp_cmn_act))
Expand Down
1 change: 1 addition & 0 deletions loxinet/neighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ func (tep *NeighTunEp) DP(work DpWorkT) int {
neighWq.SIP = tep.sIP
neighWq.TunNh = true
neighWq.TunID = tep.tunID
neighWq.TunType = tep.tunType

if tep.tunID != 0 || tep.tunType == DpTunIPIP {
for i := 0; i < 6; i++ {
Expand Down

0 comments on commit 70eb25a

Please sign in to comment.