diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-04-04 15:42:35 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-17 21:57:11 +0900 |
commit | 93c955a415f39f7f8d2a97a8298a8985d5dadc2f (patch) | |
tree | 84d1fa1ede4242ad73e72703d4462f703df5a92a /server | |
parent | 5323187cf10bb0e2cc361aca0cfd9e84396828b9 (diff) |
packet/bmp: Obsolete policy argument for BMPPeerHeader
According to "draft-evens-grow-bmp-local-rib", the L flag in the Peer
Flags is NOT used for the locally sourced routes and the F flag is
defined into the same bit.
This patch removes "policy" argument and add "flags" argument for
BMPPeerHeader and NewBMPPeerHeader in order to distinguish which flag
is set (the L flag or the F flag).
Then introduce IsPostPolicy() func to show if the L flag is set or not.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'server')
-rw-r--r-- | server/bmp.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/server/bmp.go b/server/bmp.go index 154175c5..6f1a16ee 100644 --- a/server/bmp.go +++ b/server/bmp.go @@ -198,17 +198,29 @@ type bmpClient struct { } func bmpPeerUp(laddr string, lport, rport uint16, sent, recv *bgp.BGPMessage, t uint8, policy bool, pd uint64, peeri *table.PeerInfo, timestamp int64) *bmp.BMPMessage { - ph := bmp.NewBMPPeerHeader(t, policy, pd, peeri.Address.String(), peeri.AS, peeri.ID.String(), float64(timestamp)) + var flags uint8 = 0 + if policy { + flags |= bmp.BMP_PEER_FLAG_POST_POLICY + } + ph := bmp.NewBMPPeerHeader(t, flags, pd, peeri.Address.String(), peeri.AS, peeri.ID.String(), float64(timestamp)) return bmp.NewBMPPeerUpNotification(*ph, laddr, lport, rport, sent, recv) } func bmpPeerDown(reason uint8, t uint8, policy bool, pd uint64, peeri *table.PeerInfo, timestamp int64) *bmp.BMPMessage { - ph := bmp.NewBMPPeerHeader(t, policy, pd, peeri.Address.String(), peeri.AS, peeri.ID.String(), float64(timestamp)) + var flags uint8 = 0 + if policy { + flags |= bmp.BMP_PEER_FLAG_POST_POLICY + } + ph := bmp.NewBMPPeerHeader(t, flags, pd, peeri.Address.String(), peeri.AS, peeri.ID.String(), float64(timestamp)) return bmp.NewBMPPeerDownNotification(*ph, reason, nil, []byte{}) } func bmpPeerRoute(t uint8, policy bool, pd uint64, peeri *table.PeerInfo, timestamp int64, payload []byte) *bmp.BMPMessage { - ph := bmp.NewBMPPeerHeader(t, policy, pd, peeri.Address.String(), peeri.AS, peeri.ID.String(), float64(timestamp)) + var flags uint8 = 0 + if policy { + flags |= bmp.BMP_PEER_FLAG_POST_POLICY + } + ph := bmp.NewBMPPeerHeader(t, flags, pd, peeri.Address.String(), peeri.AS, peeri.ID.String(), float64(timestamp)) m := bmp.NewBMPRouteMonitoring(*ph, nil) body := m.Body.(*bmp.BMPRouteMonitoring) body.BGPUpdatePayload = payload |