diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-24 16:40:00 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-25 03:16:18 +0000 |
commit | 6f95b7dc62b0ce8523e4f6da2e2bff5f4a4d3b78 (patch) | |
tree | 3914b8121ce115f86ea1fbbcf92e80cd52fc01f0 /gobgpd/main.go | |
parent | 205063dc8334032ccd250cabee96cd09fea76c68 (diff) |
server: issue SOFT_RESET_IN when policy assignment is changed
fix 0c58e348de62bf156582417a6b9d726dd4fe116e
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'gobgpd/main.go')
-rw-r--r-- | gobgpd/main.go | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go index 192b85f9..fc0d6e2c 100644 --- a/gobgpd/main.go +++ b/gobgpd/main.go @@ -198,6 +198,7 @@ func main() { select { case newConfig := <-configCh: var added, deleted, updated []config.Neighbor + var updatePolicy bool if c == nil { c = newConfig @@ -228,7 +229,6 @@ func main() { } } else { - var updatePolicy bool added, deleted, updated, updatePolicy = config.UpdateConfig(c, newConfig) if updatePolicy { log.Info("Policy config is updated") @@ -248,7 +248,25 @@ func main() { } for _, p := range updated { log.Infof("Peer %v is updated", p.Config.NeighborAddress) - bgpServer.PeerUpdate(p) + u, _ := bgpServer.PeerUpdate(p) + updatePolicy = updatePolicy || u + } + + if updatePolicy { + // TODO: we want to apply the new policies to the existing + // routes here. Sending SOFT_RESET_IN to all the peers works + // for the change of in and import policies. SOFT_RESET_OUT is + // necessary for the export policy but we can't blindly + // execute SOFT_RESET_OUT because we unnecessarily advertize + // the existing routes. Needs to investigate the changes of + // policies and handle only affected peers. + ch := make(chan *server.GrpcResponse) + bgpServer.GrpcReqCh <- &server.GrpcRequest{ + RequestType: server.REQ_NEIGHBOR_SOFT_RESET_IN, + Name: "all", + ResponseCh: ch, + } + <-ch } case sig := <-sigCh: switch sig { |