summaryrefslogtreecommitdiffhomepage
path: root/config/serve.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-22 07:30:40 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-22 07:42:02 +0000
commit30456e9ffd7508f96db90df2b035ad2e5cfeb904 (patch)
tree6be08df4ae80660c78e78c86e0efea178d6489a0 /config/serve.go
parent0c58e348de62bf156582417a6b9d726dd4fe116e (diff)
config: fix bug of UpdateConfig()
avoid reconfiguration when policy configuration is not changed Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config/serve.go')
-rw-r--r--config/serve.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/config/serve.go b/config/serve.go
index 3b4d7acd..21196433 100644
--- a/config/serve.go
+++ b/config/serve.go
@@ -76,15 +76,8 @@ func ConfigSetToRoutingPolicy(c *BgpConfigSet) *RoutingPolicy {
}
}
-func UpdateConfig(curC *BgpConfigSet, newC *BgpConfigSet) (*BgpConfigSet, []Neighbor, []Neighbor, []Neighbor, bool) {
- bgpConfig := &BgpConfigSet{}
- if curC == nil {
- bgpConfig.Global = newC.Global
- curC = bgpConfig
- } else {
- // can't update the global config
- bgpConfig.Global = curC.Global
- }
+func UpdateConfig(curC, newC *BgpConfigSet) ([]Neighbor, []Neighbor, []Neighbor, bool) {
+
added := []Neighbor{}
deleted := []Neighbor{}
updated := []Neighbor{}
@@ -103,8 +96,7 @@ func UpdateConfig(curC *BgpConfigSet, newC *BgpConfigSet) (*BgpConfigSet, []Neig
}
}
- bgpConfig.Neighbors = newC.Neighbors
- return bgpConfig, added, deleted, updated, CheckPolicyDifference(ConfigSetToRoutingPolicy(curC), ConfigSetToRoutingPolicy(newC))
+ return added, deleted, updated, CheckPolicyDifference(ConfigSetToRoutingPolicy(curC), ConfigSetToRoutingPolicy(newC))
}
func CheckPolicyDifference(currentPolicy *RoutingPolicy, newPolicy *RoutingPolicy) bool {