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