diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-19 22:14:11 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-19 22:14:11 +0900 |
commit | aa9af495182e822b84201e1d708cda7d2d090313 (patch) | |
tree | 0a28581f78fa89a6b77036ea518c580f86087001 /server | |
parent | fb91965dd47045339a78f2231169a9d32be52985 (diff) |
config file support rpki configuration
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/server.go | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/server/server.go b/server/server.go index 6984885f..5f708ea2 100644 --- a/server/server.go +++ b/server/server.go @@ -70,11 +70,13 @@ func (m *broadcastGrpcMsg) send() { } type BgpServer struct { - bgpConfig config.Bgp - globalTypeCh chan config.Global - addedPeerCh chan config.Neighbor - deletedPeerCh chan config.Neighbor - updatedPeerCh chan config.Neighbor + bgpConfig config.Bgp + globalTypeCh chan config.Global + addedPeerCh chan config.Neighbor + deletedPeerCh chan config.Neighbor + updatedPeerCh chan config.Neighbor + rpkiConfigCh chan config.RpkiServers + GrpcReqCh chan *GrpcRequest listenPort int policyUpdateCh chan config.RoutingPolicy @@ -88,18 +90,19 @@ type BgpServer struct { roaClient *roaClient } -func NewBgpServer(port int, roaURL string) *BgpServer { +func NewBgpServer(port int) *BgpServer { b := 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.rpkiConfigCh = make(chan config.RpkiServers) b.GrpcReqCh = make(chan *GrpcRequest, 1) b.policyUpdateCh = make(chan config.RoutingPolicy) b.localRibMap = make(map[string]*LocalRib) b.neighborMap = make(map[string]*Peer) b.listenPort = port - b.roaClient, _ = newROAClient(roaURL) + b.roaClient, _ = newROAClient("") return &b } @@ -223,6 +226,11 @@ func (server *BgpServer) Serve() { } select { + case c := <-server.rpkiConfigCh: + if len(c.RpkiServerList) > 0 { + url := fmt.Sprintf("%s:%d", c.RpkiServerList[0].RpkiServerConfig.Address, c.RpkiServerList[0].RpkiServerConfig.Port) + server.roaClient, _ = newROAClient(url) + } case rmsg := <-server.roaClient.recieveROA(): server.roaClient.handleRTRMsg(rmsg) case zmsg := <-zapiMsgCh: @@ -707,6 +715,10 @@ func (server *BgpServer) SetGlobalType(g config.Global) { server.globalTypeCh <- g } +func (server *BgpServer) SetRpkiConfig(c config.RpkiServers) { + server.rpkiConfigCh <- c +} + func (server *BgpServer) PeerAdd(peer config.Neighbor) { server.addedPeerCh <- peer } |