diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2017-08-07 08:15:16 -0400 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-08-07 22:31:26 +0900 |
commit | 539642d28791789bc52a4d23acc30fac35691fc4 (patch) | |
tree | da5285d19e75af5e140c548ffe4a43d13c16325d /table/message.go | |
parent | aa2b1c2405b9f996d8bab02d95fd0f696ddbf953 (diff) |
table: fix handling of update with both mpunreach and mpreach attribute
some implementations send a mpunreach attribute piggy backed on an
update message. Since it is stored in pathattrs of gobgp's path structure,
we need to exclude it before sending out update messages.
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/message.go')
-rw-r--r-- | table/message.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/table/message.go b/table/message.go index 30a75d24..a2b7f926 100644 --- a/table/message.go +++ b/table/message.go @@ -315,11 +315,12 @@ func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage { } } else { attrs := make([]bgp.PathAttributeInterface, 0, 8) - for _, p := range path.GetPathAttrs() { - if p.GetType() == bgp.BGP_ATTR_TYPE_MP_REACH_NLRI { + switch p.GetType() { + case bgp.BGP_ATTR_TYPE_MP_REACH_NLRI: attrs = append(attrs, bgp.NewPathAttributeMpReachNLRI(path.GetNexthop().String(), []bgp.AddrPrefixInterface{path.GetNlri()})) - } else { + case bgp.BGP_ATTR_TYPE_MP_UNREACH_NLRI: + default: attrs = append(attrs, p) } } |