Skip to content

Commit

Permalink
fix: set AddPathLen for BGP Routes when received via grpc (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
Istvan91 authored Jul 2, 2024
1 parent 110a405 commit 3fbc7fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion route/bgp_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (b *BGPPath) ToProto() *api.BGPPath {

// BGPPathFromProtoBGPPath converts a proto BGPPath to BGPPath
func BGPPathFromProtoBGPPath(pb *api.BGPPath, dedup bool) *BGPPath {
asPath := types.ASPathFromProtoASPath(pb.AsPath)
p := &BGPPath{
BGPPathA: &BGPPathA{
NextHop: bnet.IPFromProtoIP(pb.NextHop).Ptr(),
Expand All @@ -138,7 +139,8 @@ func BGPPathFromProtoBGPPath(pb *api.BGPPath, dedup bool) *BGPPath {
OnlyToCustomer: pb.OnlyToCustomer,
},
PathIdentifier: pb.PathIdentifier,
ASPath: types.ASPathFromProtoASPath(pb.AsPath),
ASPath: asPath,
ASPathLen: asPath.Length(),
BMPPostPolicy: pb.BmpPostPolicy,
}

Expand Down
1 change: 1 addition & 0 deletions route/bgp_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func TestBGPPathFromProtoBGPPath(t *testing.T) {
},
},
},
ASPathLen: 2,

Communities: &types.Communities{100, 200, 300},
LargeCommunities: &types.LargeCommunities{
Expand Down

0 comments on commit 3fbc7fd

Please sign in to comment.