diff options
-rw-r--r-- | config/util.go | 10 | ||||
-rw-r--r-- | server/server.go | 2 |
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 |