summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-04-05 15:26:42 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-04-17 21:57:11 +0900
commit7307b1490ec097921956d032f05e359ef2afdb9c (patch)
tree199a2d1320ff46f67f37b6e0f1be6c3266d7c0b2 /server
parent0f0f13417e4fbfd00ea1a2a75bf5f92fa78454e1 (diff)
bmp: BMP Route Monitoring for Local RIB routes
This patch enable to send BMP Route Monitoring message for Local RIB routes described in bmp-draft-evens-grow-bmp-local-rib. Configuration Example: gobgpd.toml ... [[bmp-servers]] [bmp-servers.config] address = "127.0.0.1" port=11019 route-monitoring-policy = "local-rib" ... Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'server')
-rw-r--r--server/bmp.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/server/bmp.go b/server/bmp.go
index 6f1a16ee..85016f47 100644
--- a/server/bmp.go
+++ b/server/bmp.go
@@ -113,10 +113,12 @@ func (b *bmpClient) loop() {
if func() bool {
ops := []WatchOption{WatchPeerState(true)}
- if b.typ != config.BMP_ROUTE_MONITORING_POLICY_TYPE_POST_POLICY {
+ if b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_PRE_POLICY || b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_BOTH {
ops = append(ops, WatchUpdate(true))
- } else if b.typ != config.BMP_ROUTE_MONITORING_POLICY_TYPE_PRE_POLICY {
+ } else if b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_POST_POLICY || b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_BOTH {
ops = append(ops, WatchPostUpdate(true))
+ } else if b.typ == config.BMP_ROUTE_MONITORING_POLICY_TYPE_LOCAL_RIB {
+ ops = append(ops, WatchBestPath(true))
}
w := b.s.Watch(ops...)
defer w.Stop()
@@ -162,6 +164,15 @@ func (b *bmpClient) loop() {
return false
}
}
+ case *WatchEventBestPath:
+ for _, p := range msg.PathList {
+ u := table.CreateUpdateMsgFromPaths([]*table.Path{p})[0]
+ if payload, err := u.Serialize(); err != nil {
+ return false
+ } else if err = write(bmpPeerRoute(bmp.BMP_PEER_TYPE_LOCAL_RIB, false, 0, p.GetSource(), p.GetTimestamp().Unix(), payload)); err != nil {
+ return false
+ }
+ }
case *WatchEventPeerState:
info := &table.PeerInfo{
Address: msg.PeerAddress,