diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-08-03 04:27:33 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-04 22:07:46 +0900 |
commit | bba54bdaa14c1a4c13245548757b38a89531fd9b (patch) | |
tree | ee8b87c207dc489d64f0a6e55c2bca0ede3f20bf /api/grpc_server.go | |
parent | 00f8406cb6a207341ea4f68a8fa294f31eb7bc7b (diff) |
skip asn negotiation for BGP unnumbered peers
since BGP unnumbered peers are typically trusted, skip asn negotiation
for easy configuration.
from configuration file:
```toml
[[neighbors]]
[[neighbors.config]]
neighbor-interface = "eth0"
```
from cli:
```
$ gobgp neighbor add interface eth0
```
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r-- | api/grpc_server.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go index 9fc66bde..33ee13c5 100644 --- a/api/grpc_server.go +++ b/api/grpc_server.go @@ -195,6 +195,8 @@ func NewPeerFromConfigStruct(pconf *config.Neighbor) *Peer { Received: s.AdjTable.Received, Accepted: s.AdjTable.Accepted, Advertised: s.AdjTable.Advertised, + PeerAs: s.PeerAs, + PeerType: uint32(s.PeerType.ToInt()), }, Timers: &Timers{ Config: &TimersConfig{ @@ -429,15 +431,16 @@ func (s *Server) MonitorPeerState(arg *Arguments, stream GobgpApi_MonitorPeerSta case ev := <-w.Event(): switch msg := ev.(type) { case *server.WatchEventPeerState: - if len(arg.Name) > 0 && arg.Name != msg.PeerAddress.String() { + if len(arg.Name) > 0 && arg.Name != msg.PeerAddress.String() && arg.Name != msg.PeerInterface { continue } if err := stream.Send(&Peer{ Conf: &PeerConf{ - PeerAs: msg.PeerAS, - LocalAs: msg.LocalAS, - NeighborAddress: msg.PeerAddress.String(), - Id: msg.PeerID.String(), + PeerAs: msg.PeerAS, + LocalAs: msg.LocalAS, + NeighborAddress: msg.PeerAddress.String(), + Id: msg.PeerID.String(), + NeighborInterface: msg.PeerInterface, }, Info: &PeerState{ PeerAs: msg.PeerAS, @@ -961,6 +964,8 @@ func NewNeighborFromAPIStruct(a *Peer) (*config.Neighbor, error) { pconf.State.AdjTable.Received = a.Info.Received pconf.State.AdjTable.Accepted = a.Info.Accepted pconf.State.AdjTable.Advertised = a.Info.Advertised + pconf.State.PeerAs = a.Info.PeerAs + pconf.State.PeerType = config.IntToPeerTypeMap[int(a.Info.PeerType)] if a.Info.Messages != nil { if a.Info.Messages.Sent != nil { |