diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-11-13 12:42:30 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-11-13 12:42:30 +0900 |
commit | 12ae1b784d400103623aca5554382e84d9843a28 (patch) | |
tree | 7ee602f7f40cc00cb3b8c9c04a77d4bd9499ffd5 /packet | |
parent | 515abe28802b7062f3af080c0bd0187e2aa62280 (diff) |
mrt: use on-wire original update data for mrt
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')
-rw-r--r-- | packet/mrt.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packet/mrt.go b/packet/mrt.go index 7c336684..15dbc839 100644 --- a/packet/mrt.go +++ b/packet/mrt.go @@ -641,8 +641,9 @@ func NewBGP4MPStateChange(peeras, localas uint32, intfindex uint16, peerip, loca type BGP4MPMessage struct { *BGP4MPHeader - BGPMessage *BGPMessage - isLocal bool + BGPMessage *BGPMessage + BGPMessagePayload []byte + isLocal bool } func (m *BGP4MPMessage) DecodeFromBytes(data []byte) error { @@ -668,6 +669,9 @@ func (m *BGP4MPMessage) Serialize() ([]byte, error) { if err != nil { return nil, err } + if m.BGPMessagePayload != nil { + return append(buf, m.BGPMessagePayload...), nil + } bbuf, err := m.BGPMessage.Serialize() if err != nil { return nil, err |