diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-08-27 00:04:39 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-27 00:51:19 +0900 |
commit | 319841ac5ec46c9e26517c83b56800155fb1498b (patch) | |
tree | 9b1948f83995737b2c8840fe6077e155defbb679 | |
parent | 51494759aded7098e151869e66dd5b2c4d96ecfd (diff) |
api: add route family field to struct Path
we can't parse Path.nlri field (whose type is []byte) without route family.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r-- | api/gobgp.pb.go | 1 | ||||
-rw-r--r-- | api/gobgp.proto | 1 | ||||
-rw-r--r-- | table/path.go | 7 |
3 files changed, 7 insertions, 2 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go index dbcc63d5..876d5218 100644 --- a/api/gobgp.pb.go +++ b/api/gobgp.pb.go @@ -328,6 +328,7 @@ type Path struct { IsWithdraw bool `protobuf:"varint,5,opt,name=is_withdraw" json:"is_withdraw,omitempty"` Validation int32 `protobuf:"varint,6,opt,name=validation" json:"validation,omitempty"` NoImplicitWithdraw bool `protobuf:"varint,7,opt,name=no_implicit_withdraw" json:"no_implicit_withdraw,omitempty"` + Rf uint32 `protobuf:"varint,8,opt,name=rf" json:"rf,omitempty"` } func (m *Path) Reset() { *m = Path{} } diff --git a/api/gobgp.proto b/api/gobgp.proto index 135fff8c..024f699a 100644 --- a/api/gobgp.proto +++ b/api/gobgp.proto @@ -143,6 +143,7 @@ message Path { bool is_withdraw = 5; int32 validation = 6; bool no_implicit_withdraw = 7; + uint32 rf = 8; } message Destination { diff --git a/table/path.go b/table/path.go index bc982cec..62f0e437 100644 --- a/table/path.go +++ b/table/path.go @@ -143,7 +143,9 @@ func (path *Path) IsIBGP() bool { } func (path *Path) ToApiStruct() *api.Path { - nlri, _ := path.GetNlri().Serialize() + nlri := path.GetNlri() + n, _ := nlri.Serialize() + rf := uint32(bgp.AfiSafiToRouteFamily(nlri.AFI(), nlri.SAFI())) pattrs := func(arg []bgp.PathAttributeInterface) [][]byte { ret := make([][]byte, 0, len(arg)) for _, a := range arg { @@ -153,11 +155,12 @@ func (path *Path) ToApiStruct() *api.Path { return ret }(path.GetPathAttrs()) return &api.Path{ - Nlri: nlri, + Nlri: n, Pattrs: pattrs, Age: int64(time.Now().Sub(path.timestamp).Seconds()), IsWithdraw: path.IsWithdraw, Validation: int32(path.Validation), + Rf: rf, } } |