diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-25 21:42:45 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-25 21:42:45 +0900 |
commit | b334dd4185bc91afd405ba326a03c09cfe9a9623 (patch) | |
tree | 1e83906410c7f5e8ee4e1364807fe6320d80ab13 | |
parent | e97594e0218584d766eaaa5822bb58bd26a7bb9d (diff) |
cli: sort path attributes
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | gobgp/cmd/global.go | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/gobgp/cmd/global.go b/gobgp/cmd/global.go index 5d680e51..62d5ee3d 100644 --- a/gobgp/cmd/global.go +++ b/gobgp/cmd/global.go @@ -499,37 +499,13 @@ func ParsePath(rf bgp.RouteFamily, args []string) (*api.Path, error) { Pattrs: make([][]byte, 0), } - args, nexthop, err := extractNexthop(rf, args) - if err != nil { - return nil, err - } - - var med []byte - args, med, err = extractMed(args) - if err != nil { - return nil, err - } - if med != nil { - path.Pattrs = append(path.Pattrs, med) - } - - var localPref []byte - args, localPref, err = extractLocalPref(args) - if err != nil { - return nil, err - } - if localPref != nil { - path.Pattrs = append(path.Pattrs, localPref) - } + origin, _ := bgp.NewPathAttributeOrigin(bgp.BGP_ORIGIN_ATTR_TYPE_INCOMPLETE).Serialize() + path.Pattrs = append(path.Pattrs, origin) - var aigp []byte - args, aigp, err = extractAigp(args) + args, nexthop, err := extractNexthop(rf, args) if err != nil { return nil, err } - if aigp != nil { - path.Pattrs = append(path.Pattrs, aigp) - } switch rf { case bgp.RF_IPv4_UC, bgp.RF_IPv6_UC: @@ -602,8 +578,23 @@ func ParsePath(rf bgp.RouteFamily, args []string) (*api.Path, error) { path.Pattrs = append(path.Pattrs, mpreach) } - origin, _ := bgp.NewPathAttributeOrigin(bgp.BGP_ORIGIN_ATTR_TYPE_INCOMPLETE).Serialize() - path.Pattrs = append(path.Pattrs, origin) + var med []byte + args, med, err = extractMed(args) + if err != nil { + return nil, err + } + if med != nil { + path.Pattrs = append(path.Pattrs, med) + } + + var localPref []byte + args, localPref, err = extractLocalPref(args) + if err != nil { + return nil, err + } + if localPref != nil { + path.Pattrs = append(path.Pattrs, localPref) + } if extcomms != nil && len(extcomms) > 0 { extcomms, err := ParseExtendedCommunities(strings.Join(extcomms, " ")) @@ -617,6 +608,15 @@ func ParsePath(rf bgp.RouteFamily, args []string) (*api.Path, error) { } path.Pattrs = append(path.Pattrs, buf) } + var aigp []byte + args, aigp, err = extractAigp(args) + if err != nil { + return nil, err + } + if aigp != nil { + path.Pattrs = append(path.Pattrs, aigp) + } + return path, nil } |