summaryrefslogtreecommitdiffhomepage
path: root/packet/bmp.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-13 13:05:24 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-11-13 13:05:24 +0900
commit072a0b07bd151a49d1dcdec7a1bb224ff3cdae38 (patch)
tree83a9ea68816a4b5cd40770c59ae2cf0e5475597a /packet/bmp.go
parent12ae1b784d400103623aca5554382e84d9843a28 (diff)
bmp: use on-wire original update data
bgpd parse on-wire original update data to construct BGPMessage object and serialize it. Sometimes the both data is not idential. For example, the original data sets the extended length for attribute even if the length is less than 256. This commit fixes the above issue. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet/bmp.go')
-rw-r--r--packet/bmp.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/packet/bmp.go b/packet/bmp.go
index 587a9fd7..eceb1272 100644
--- a/packet/bmp.go
+++ b/packet/bmp.go
@@ -136,7 +136,8 @@ func (h *BMPPeerHeader) Serialize() ([]byte, error) {
}
type BMPRouteMonitoring struct {
- BGPUpdate *BGPMessage
+ BGPUpdate *BGPMessage
+ BGPUpdatePayload []byte
}
func NewBMPRouteMonitoring(p BMPPeerHeader, update *BGPMessage) *BMPMessage {
@@ -162,6 +163,9 @@ func (body *BMPRouteMonitoring) ParseBody(msg *BMPMessage, data []byte) error {
}
func (body *BMPRouteMonitoring) Serialize() ([]byte, error) {
+ if body.BGPUpdatePayload != nil {
+ return body.BGPUpdatePayload, nil
+ }
return body.BGPUpdate.Serialize()
}