From 2d73cf8eba6a8c978442dccc2d4c1ad9538ca1a9 Mon Sep 17 00:00:00 2001 From: Imcom Jin Date: Thu, 25 Feb 2021 14:19:49 +0800 Subject: bugfix: should check if next-hop attr exists or not before append --- internal/pkg/table/message.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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() -- cgit v1.2.3