diff options
Diffstat (limited to 'api/util.go')
-rw-r--r-- | api/util.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/api/util.go b/api/util.go index 7cb9d2b8..ce7a1d02 100644 --- a/api/util.go +++ b/api/util.go @@ -46,7 +46,7 @@ func (t *Table) ToNativeTable(option ...ToNativeOption) (*table.Table, error) { } func getNLRI(family bgp.RouteFamily, buf []byte) (bgp.AddrPrefixInterface, error) { - afi, safi := bgp.RouteFamilyToAfiSafi(bgp.RouteFamily(family)) + afi, safi := bgp.RouteFamilyToAfiSafi(family) nlri, err := bgp.NewPrefixFromRouteFamily(afi, safi) if err != nil { return nil, err @@ -85,6 +85,10 @@ func (d *Destination) ToNativeDestination(option ...ToNativeOption) (*table.Dest return table.NewDestination(nlri, 0, paths...), nil } +func (p *Path) GetNativeNlri() (bgp.AddrPrefixInterface, error) { + return getNLRI(bgp.RouteFamily(p.Family), p.Nlri) +} + func (p *Path) ToNativePath(option ...ToNativeOption) (*table.Path, error) { info := &table.PeerInfo{ AS: p.SourceAsn, |