summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2018-04-19 15:52:41 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-05-24 10:13:56 +0900
commitabefa741b81b833943987f7540284883a48a9ffb (patch)
tree72056bf625fd6878b8d2a6d55831261ce63debc6
parenteb568b68d2522a21ad87c95e427024113aea07dd (diff)
server/server: Restart peers when capabilities are changed
If capabilities are added or removed by updating peer configs, it is needed to resend Open Message contains the new capabilities. But currently, GoBGP does not resend Open Message for Add-Path and Graceful Restart capabilities. This commit fixes it to resend Open Message for them. Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
-rw-r--r--config/util.go10
-rw-r--r--server/server.go2
2 files changed, 10 insertions, 2 deletions
diff --git a/config/util.go b/config/util.go
index aa393f14..7cd8c01e 100644
--- a/config/util.go
+++ b/config/util.go
@@ -216,7 +216,7 @@ func existPeerGroup(n string, b []PeerGroup) int {
return -1
}
-func CheckAfiSafisChange(x, y []AfiSafi) bool {
+func isAfiSafiChanged(x, y []AfiSafi) bool {
if len(x) != len(y) {
return true
}
@@ -232,6 +232,14 @@ func CheckAfiSafisChange(x, y []AfiSafi) bool {
return false
}
+func (n *Neighbor) NeedsResendOpenMessage(new *Neighbor) bool {
+ return !n.Config.Equal(&new.Config) ||
+ !n.Transport.Config.Equal(&new.Transport.Config) ||
+ !n.AddPaths.Config.Equal(&new.AddPaths.Config) ||
+ !n.GracefulRestart.Config.Equal(&new.GracefulRestart.Config) ||
+ isAfiSafiChanged(n.AfiSafis, new.AfiSafis)
+}
+
func ParseMaskLength(prefix, mask string) (int, int, error) {
_, ipNet, err := net.ParseCIDR(prefix)
if err != nil {
diff --git a/server/server.go b/server/server.go
index 473c255e..82b6ee4b 100644
--- a/server/server.go
+++ b/server/server.go
@@ -2250,7 +2250,7 @@ func (s *BgpServer) updateNeighbor(c *config.Neighbor) (needsSoftResetIn bool, e
needsSoftResetIn = true
}
- if !original.Config.Equal(&c.Config) || !original.Transport.Config.Equal(&c.Transport.Config) || config.CheckAfiSafisChange(original.AfiSafis, c.AfiSafis) {
+ if original.NeedsResendOpenMessage(c) {
sub := uint8(bgp.BGP_ERROR_SUB_OTHER_CONFIGURATION_CHANGE)
if original.Config.AdminDown != c.Config.AdminDown {
sub = bgp.BGP_ERROR_SUB_ADMINISTRATIVE_SHUTDOWN