mirror of
https://github.com/luscis/openlan.git
synced 2025-10-16 05:30:38 +08:00
fix: add origin for routes.
This commit is contained in:
@@ -2,6 +2,10 @@ package _switch
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/luscis/openlan/pkg/api"
|
||||
"github.com/luscis/openlan/pkg/cache"
|
||||
co "github.com/luscis/openlan/pkg/config"
|
||||
@@ -9,9 +13,6 @@ import (
|
||||
"github.com/luscis/openlan/pkg/models"
|
||||
"github.com/luscis/openlan/pkg/network"
|
||||
"github.com/vishvananda/netlink"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func PeerName(name, prefix string) (string, string) {
|
||||
@@ -57,6 +58,9 @@ func (w *OpenLANWorker) Initialize() {
|
||||
if rt.Metric > 0 {
|
||||
rte.Metric = rt.Metric
|
||||
}
|
||||
if rt.NextHop != "" {
|
||||
rte.Origin = rt.NextHop
|
||||
}
|
||||
n.Routes = append(n.Routes, rte)
|
||||
}
|
||||
cache.Network.Add(&n)
|
||||
|
Reference in New Issue
Block a user