diff options
author | Imcom Jin <jinyu.bjut@gmail.com> | 2021-02-25 14:05:58 +0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2021-03-03 09:28:08 +0900 |
commit | 82d2877c7038336d14cbd19c687dd8026eadb149 (patch) | |
tree | 786f613fd3de0f03acc11de7eaf0c779b529baf1 /internal/pkg/table/table_manager.go | |
parent | 5960e8ebd1e37632098efcfd00818bb5f7d24a2f (diff) |
fixing an issue when gobgp sits between a MP-capable peer and a non-MP-capable peer
whereby MP-capable peer uses MP_REACH_NLRI to send updates to gobgp
gobgp accepts it but without setting NEXT_HOP pathattr
then gobgp propagates the paths to the non-MP-capable peer with update.NLRI set but without NEXT_HOP
the non-MP-capable peer will treat the update as withdraw message cause routes cannot propagate properly
Diffstat (limited to 'internal/pkg/table/table_manager.go')
-rw-r--r-- | internal/pkg/table/table_manager.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/pkg/table/table_manager.go b/internal/pkg/table/table_manager.go index b16f135b..0bf60bc1 100644 --- a/internal/pkg/table/table_manager.go +++ b/internal/pkg/table/table_manager.go @@ -60,6 +60,8 @@ func ProcessMessage(m *bgp.BGPMessage, peerInfo *PeerInfo, timestamp time.Time) l = append(l, a.Value...) dels = append(dels, l...) default: + // update msg may not contain next_hop (type:3) in attr + // due to it uses MpReachNLRI and it also has empty update.NLRI attrs = append(attrs, attr) } } @@ -92,6 +94,11 @@ func ProcessMessage(m *bgp.BGPMessage, peerInfo *PeerInfo, timestamp time.Time) reachAttrs[len(reachAttrs)-1] = reach for _, nlri := range reach.Value { + // when build path from reach + // reachAttrs might not contain next_hop if `attrs` does not have one + // this happens when a MP peer send update to gobgp + // However nlri is always populated because how we build the path + // path.info{nlri: nlri} p := NewPath(peerInfo, nlri, false, reachAttrs, timestamp, false) p.SetHash(hash) pathList = append(pathList, p) |