mirror of
https://github.com/luscis/openlan.git
synced 2025-10-25 18:01:53 +08:00
fix: prefix as unique key for route
This commit is contained in:
5
pkg/cache/network.go
vendored
5
pkg/cache/network.go
vendored
@@ -2,11 +2,12 @@ package cache
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"net"
|
||||
|
||||
co "github.com/luscis/openlan/pkg/config"
|
||||
"github.com/luscis/openlan/pkg/libol"
|
||||
"github.com/luscis/openlan/pkg/models"
|
||||
"github.com/luscis/openlan/pkg/schema"
|
||||
"net"
|
||||
)
|
||||
|
||||
type network struct {
|
||||
@@ -57,7 +58,7 @@ func (w *network) DelRoute(name string, rt co.PrefixRoute) {
|
||||
n := w.Get(name)
|
||||
if n != nil {
|
||||
for i, route := range n.Routes {
|
||||
if route.Prefix == rt.Prefix && (route.NextHop == rt.NextHop || route.Origin == rt.NextHop) {
|
||||
if route.Prefix == rt.Prefix {
|
||||
n.Routes = append(n.Routes[:i], n.Routes[i+1:]...)
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user