summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gobgpd/main.go8
-rw-r--r--server/server.go7
2 files changed, 9 insertions, 6 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go
index 1b5cd959..4f44e328 100644
--- a/gobgpd/main.go
+++ b/gobgpd/main.go
@@ -184,6 +184,14 @@ func main() {
if policyConfig == nil {
policyConfig = &newConfig.Policy
+ // FIXME: Currently the following code
+ // is safe because the above
+ // SetRpkiConfig will be blocked
+ // because the length of rpkiConfigCh
+ // is zero. So server.GlobalRib is
+ // allocated before the above
+ // SetPolicy. But this should be
+ // handled more cleanly.
if err := bgpServer.SetPolicy(newConfig.Policy); err != nil {
log.Fatal(err)
}
diff --git a/server/server.go b/server/server.go
index 16bb0c97..936734c0 100644
--- a/server/server.go
+++ b/server/server.go
@@ -211,9 +211,6 @@ func (server *BgpServer) Serve() {
}(g.AfiSafis.AfiSafiList)
server.globalRib = table.NewTableManager(GLOBAL_RIB_NAME, rfList, g.MplsLabelRange.MinLabel, g.MplsLabelRange.MaxLabel)
- if server.policy != nil {
- server.setPolicyByConfig(server.globalRib, g.ApplyPolicy)
- }
listenerMap := make(map[string]*net.TCPListener)
acceptCh := make(chan *net.TCPConn)
l4, err1 := listenAndAccept("tcp4", server.listenPort, acceptCh)
@@ -888,9 +885,7 @@ func (server *BgpServer) SetPolicy(pl config.RoutingPolicy) error {
return err
}
server.policy = p
- if server.globalRib != nil {
- server.setPolicyByConfig(server.globalRib, server.bgpConfig.Global.ApplyPolicy)
- }
+ server.setPolicyByConfig(server.globalRib, server.bgpConfig.Global.ApplyPolicy)
return nil
}