mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-21 02:40:24 +08:00
fix route
This commit is contained in:
@@ -52,13 +52,10 @@ func (r *Router) NextHop(ip string) *Link {
|
|||||||
r.mu.RLock()
|
r.mu.RLock()
|
||||||
defer r.mu.RUnlock()
|
defer r.mu.RUnlock()
|
||||||
|
|
||||||
for c, l := range r.table {
|
for _, c := range r.list {
|
||||||
_, cdr, err := net.ParseCIDR(c)
|
if c.Contains(ipb) {
|
||||||
if err == nil {
|
logrus.Infoln("[router] get nexthop to", ipb, "-->", c)
|
||||||
if cdr.Contains(ipb) {
|
return r.table[c.String()]
|
||||||
logrus.Infoln("[router] get nexthop to", ipb, "-->", cdr)
|
|
||||||
return l
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user