diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-09-04 14:30:13 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-09-08 13:13:37 +0900 |
commit | d8dc45772cd1a384cb15917bea43cac5d2a04f10 (patch) | |
tree | 26a4f2eec14a791546d2bf254626286b6dbe1cd2 /server/peer.go | |
parent | 9298e5eeca78e8bb02ff34b500add622b73b4f5f (diff) |
api: kill api.Capability
keep protobuf structures simple
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/peer.go b/server/peer.go index 67e2c437..45cb1c79 100644 --- a/server/peer.go +++ b/server/peer.go @@ -135,7 +135,7 @@ func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) ([]*table.Path, bool, []*b if c.Code() == bgp.BGP_CAP_MULTIPROTOCOL { m := c.(*bgp.CapMultiProtocol) - r[bgp.AfiSafiToRouteFamily(m.CapValue.AFI, m.CapValue.SAFI)] = true + r[m.CapValue] = true } } } @@ -246,17 +246,19 @@ func (peer *Peer) ToApiStruct() *api.Peer { f := peer.fsm c := f.pConf - remoteCap := make([]*api.Capability, 0, len(peer.capMap)) + remoteCap := make([][]byte, 0, len(peer.capMap)) for _, c := range peer.capMap { for _, m := range c { - remoteCap = append(remoteCap, m.ToApiStruct()) + buf, _ := m.Serialize() + remoteCap = append(remoteCap, buf) } } caps := capabilitiesFromConfig(&peer.gConf, &peer.conf) - localCap := make([]*api.Capability, 0, len(caps)) + localCap := make([][]byte, 0, len(caps)) for _, c := range caps { - localCap = append(localCap, c.ToApiStruct()) + buf, _ := c.Serialize() + localCap = append(localCap, buf) } conf := &api.PeerConf{ |