diff options
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go index 78a15da9..46184697 100644 --- a/server/server.go +++ b/server/server.go @@ -73,6 +73,7 @@ type BgpServer struct { globalTypeCh chan config.Global addedPeerCh chan config.Neighbor deletedPeerCh chan config.Neighbor + updatedPeerCh chan config.Neighbor GrpcReqCh chan *GrpcRequest listenPort int policyUpdateCh chan config.RoutingPolicy @@ -91,6 +92,7 @@ func NewBgpServer(port int, roaURL string) *BgpServer { b.globalTypeCh = make(chan config.Global) b.addedPeerCh = make(chan config.Neighbor) b.deletedPeerCh = make(chan config.Neighbor) + b.updatedPeerCh = make(chan config.Neighbor) b.GrpcReqCh = make(chan *GrpcRequest, 1) b.policyUpdateCh = make(chan config.RoutingPolicy) b.localRibMap = make(map[string]*LocalRib) @@ -300,6 +302,15 @@ func (server *BgpServer) Serve() { } else { log.Info("Can't delete a peer configuration for ", addr) } + case config := <-server.updatedPeerCh: + addr := config.NeighborConfig.NeighborAddress.String() + peer := server.neighborMap[addr] + if peer.conf.RouteServer.RouteServerClient == true { + peer.conf.ApplyPolicy = config.ApplyPolicy + loc := server.localRibMap[addr] + loc.setPolicy(peer, server.policyMap) + peer.setDistributePolicy(server.policyMap) + } case e := <-incoming: peer, found := server.neighborMap[e.MsgSrc] if !found { @@ -695,6 +706,10 @@ func (server *BgpServer) PeerDelete(peer config.Neighbor) { server.deletedPeerCh <- peer } +func (server *BgpServer) PeerUpdate(peer config.Neighbor) { + server.updatedPeerCh <- peer +} + func (server *BgpServer) UpdatePolicy(policy config.RoutingPolicy) { server.policyUpdateCh <- policy } |