diff options
author | Imcom Jin <jinyu.bjut@gmail.com> | 2021-02-25 14:19:49 +0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2021-03-03 09:28:08 +0900 |
commit | 2d73cf8eba6a8c978442dccc2d4c1ad9538ca1a9 (patch) | |
tree | 4df30e3713cbb8ab87ab56394cfbe755fd1e9bbd /internal | |
parent | 82d2877c7038336d14cbd19c687dd8026eadb149 (diff) |
bugfix: should check if next-hop attr exists or not before append
Diffstat (limited to 'internal')
-rw-r--r-- | internal/pkg/table/message.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/pkg/table/message.go b/internal/pkg/table/message.go index 9bd843e2..369fb6d6 100644 --- a/internal/pkg/table/message.go +++ b/internal/pkg/table/message.go @@ -447,7 +447,9 @@ func (p *packerV4) pack(options ...*bgp.MarshallingOption) []*bgp.BGPMessage { // we should make sure that we next-hop exists in pathattrs // while we build the update message // we do not want to modify the `path` though - attrs = append(attrs, bgp.NewPathAttributeNextHop(paths[0].GetNexthop().String())) + if paths[0].getPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP) == nil { + attrs = append(attrs, bgp.NewPathAttributeNextHop(paths[0].GetNexthop().String())) + } attrsLen := 0 for _, a := range attrs { attrsLen += a.Len() |