From 87f0b0bdc52945ae98ef6d44b7f118216bde95ca Mon Sep 17 00:00:00 2001 From: Wataru Ishida Date: Sun, 18 Sep 2016 05:06:18 +0000 Subject: api/cli: support showing path-identifier $ gobgp neighbor ID Network Next Hop AS_PATH Age Attrs 2 10.0.0.10/32 10.10.1.2 01:05:35 [{Origin: i} {LocalPref: 100}] 1 10.0.0.10/32 10.10.1.1 01:05:35 [{Origin: i} {LocalPref: 100}] 3 10.1.0.10/32 10.10.1.3 01:05:35 [{Origin: i} {LocalPref: 100}] Signed-off-by: Wataru Ishida --- api/util.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'api/util.go') diff --git a/api/util.go b/api/util.go index ea385862..dabb65b7 100644 --- a/api/util.go +++ b/api/util.go @@ -70,7 +70,13 @@ func (d *Destination) ToNativeDestination(option ...ToNativeOption) (*table.Dest }) paths := make([]*table.Path, 0, len(d.Paths)) for _, p := range d.Paths { - path, err := p.ToNativePath(option...) + var path *table.Path + var err error + if p.Identifier > 0 { + path, err = p.ToNativePath() + } else { + path, err = p.ToNativePath(option...) + } if err != nil { return nil, err } @@ -113,6 +119,7 @@ func (p *Path) ToNativePath(option ...ToNativeOption) (*table.Path, error) { pattr = append(pattr, p) } t := time.Unix(p.Age, 0) + nlri.SetPathIdentifier(p.Identifier) path := table.NewPath(info, nlri, p.IsWithdraw, pattr, t, false) path.SetValidation(config.IntToRpkiValidationResultTypeMap[int(p.Validation)]) path.MarkStale(p.Stale) -- cgit v1.2.3