summaryrefslogtreecommitdiffhomepage
path: root/table/table_manager.go
diff options
context:
space:
mode:
Diffstat (limited to 'table/table_manager.go')
-rw-r--r--table/table_manager.go27
1 files changed, 23 insertions, 4 deletions
diff --git a/table/table_manager.go b/table/table_manager.go
index b59912f6..9fe4032a 100644
--- a/table/table_manager.go
+++ b/table/table_manager.go
@@ -18,7 +18,6 @@ package table
import (
log "github.com/Sirupsen/logrus"
"github.com/osrg/gobgp/packet"
- "net"
"os"
"time"
)
@@ -138,6 +137,13 @@ type ProcessMessage struct {
fromPeer *PeerInfo
}
+func NewProcessMessage(m *bgp.BGPMessage, peerInfo *PeerInfo) *ProcessMessage {
+ return &ProcessMessage{
+ innerMessage: m,
+ fromPeer: peerInfo,
+ }
+}
+
func (p *ProcessMessage) nlri2Path() []Path {
updateMsg := p.innerMessage.Body.(*bgp.BGPUpdate)
pathAttributes := updateMsg.PathAttributes
@@ -353,9 +359,23 @@ func NewAdjRib() *AdjRib {
return r
}
+func (adj *AdjRib) UpdateIn(pathList []Path) {
+ for _, path := range pathList {
+ rf := path.getRouteFamily()
+ key := path.getPrefix().String()
+ if path.isWithdraw() {
+ _, found := adj.adjRibIn[rf][key]
+ if found {
+ delete(adj.adjRibIn[rf], key)
+ }
+ } else {
+ adj.adjRibIn[rf][key] = NewReceivedRoute(path, false)
+ }
+ }
+}
+
type ReceivedRoute struct {
path Path
- fromPeer *net.IP
filtered bool
timestamp time.Time
}
@@ -364,11 +384,10 @@ func (rr *ReceivedRoute) String() string {
return rr.path.(*PathDefault).getPrefix().String()
}
-func NewReceivedRoute(path Path, peer *net.IP, filtered bool) *ReceivedRoute {
+func NewReceivedRoute(path Path, filtered bool) *ReceivedRoute {
rroute := &ReceivedRoute{
path: path,
- fromPeer: peer,
filtered: filtered,
timestamp: time.Now(),
}