Skip to content

Commit

Permalink
Merge pull request #610 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
PR - Support for static interface routes (fixes)
  • Loading branch information
UltraInstinct14 authored Mar 31, 2024
2 parents d66fd89 + 634e2d9 commit 408baff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions loxinet/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,17 @@ func (r *RtH) RtAdd(Dst net.IPNet, Zone string, Ra RtAttr, Na []RtNhAttr) (int,
// If this is a host route then neighbor has to exist
// Usually host route addition is triggered by neigh add
if Ra.HostRoute && !Ra.IfRoute {
delete(r.RtMap, rt.Key)
r.Mark.PutCounter(rt.Mark)
tk.LogIt(tk.LogError, "rt add host - %s:%s no neigh\n", Dst.String(), Zone)
return RtNhErr, errors.New("rt-neigh host error")
}

r.Zone.Nh.NeighAdd(Na[i].NhAddr, Zone, NeighAttr{Na[i].LinkIndex, 0, hwmac})
nh, _ = r.Zone.Nh.NeighFind(Na[i].NhAddr, Zone)
if nh == nil {
delete(r.RtMap, rt.Key)
r.Mark.PutCounter(rt.Mark)
tk.LogIt(tk.LogError, "rt add - %s:%s no neigh\n", Dst.String(), Zone)
return RtNhErr, errors.New("rt-neigh error")
}
Expand Down Expand Up @@ -325,6 +329,8 @@ func (r *RtH) RtAdd(Dst net.IPNet, Zone string, Ra RtAttr, Na []RtNhAttr) (int,
for i := 0; i < len(newNhs); i++ {
r.Zone.Nh.NeighDelete(newNhs[i].Addr, Zone)
}
delete(r.RtMap, rt.Key)
r.Mark.PutCounter(rt.Mark)
fmt.Printf("rt add - %s:%s lpm add fail\n", Dst.String(), Zone)
tk.LogIt(tk.LogError, "rt add - %s:%s lpm add fail\n", Dst.String(), Zone)
return RtTrieAddErr, errors.New("RT Trie Err")
Expand Down

0 comments on commit 408baff

Please sign in to comment.