summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/table
diff options
context:
space:
mode:
authorImcom Jin <jinyu.bjut@gmail.com>2021-02-25 14:19:49 +0800
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2021-03-03 09:28:08 +0900
commit2d73cf8eba6a8c978442dccc2d4c1ad9538ca1a9 (patch)
tree4df30e3713cbb8ab87ab56394cfbe755fd1e9bbd /internal/pkg/table
parent82d2877c7038336d14cbd19c687dd8026eadb149 (diff)
bugfix: should check if next-hop attr exists or not before append
Diffstat (limited to 'internal/pkg/table')
-rw-r--r--internal/pkg/table/message.go4
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()