summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/server/server.go b/server/server.go
index bcecdd59..7d6194f4 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1762,13 +1762,16 @@ func (server *BgpServer) addNeighbor(c *config.Neighbor) error {
return fmt.Errorf("Can't overwrite the existing peer: %s", addr)
}
+ var pgConf *config.PeerGroup
if c.Config.PeerGroup != "" {
- if err := config.OverwriteNeighborConfigWithPeerGroup(c, server.peerGroupMap[c.Config.PeerGroup].Conf); err != nil {
- return err
+ pg, ok := server.peerGroupMap[c.Config.PeerGroup]
+ if !ok {
+ return fmt.Errorf("no such peer-group: %s", c.Config.PeerGroup)
}
+ pgConf = pg.Conf
}
- if err := config.SetDefaultNeighborConfigValues(c, &server.bgpConfig.Global); err != nil {
+ if err := config.SetDefaultNeighborConfigValues(c, pgConf, &server.bgpConfig.Global); err != nil {
return err
}
@@ -1965,8 +1968,12 @@ func (s *BgpServer) UpdatePeerGroup(pg *config.PeerGroup) (needsSoftResetIn bool
func (s *BgpServer) updateNeighbor(c *config.Neighbor) (needsSoftResetIn bool, err error) {
if c.Config.PeerGroup != "" {
- if err := config.OverwriteNeighborConfigWithPeerGroup(c, s.peerGroupMap[c.Config.PeerGroup].Conf); err != nil {
- return needsSoftResetIn, err
+ if pg, ok := s.peerGroupMap[c.Config.PeerGroup]; ok {
+ if err := config.SetDefaultNeighborConfigValues(c, pg.Conf, &s.bgpConfig.Global); err != nil {
+ return needsSoftResetIn, err
+ }
+ } else {
+ return needsSoftResetIn, fmt.Errorf("no such peer-group: %s", c.Config.PeerGroup)
}
}