Skip to content

Commit

Permalink
Fix defaulting for UpdatePeer + make IdleHoldTimeAfterReset actually …
Browse files Browse the repository at this point in the history
…configurable

Signed-off-by: Rastislav Szabo <rastislav.szabo@isovalent.com>
  • Loading branch information
rastislavs committed May 22, 2023
1 parent 9cff3f4 commit f8c6d24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/server/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ func newNeighborFromAPIStruct(a *api.Peer) (*config.Neighbor, error) {
pconf.Timers.Config.HoldTime = float64(a.Timers.Config.HoldTime)
pconf.Timers.Config.KeepaliveInterval = float64(a.Timers.Config.KeepaliveInterval)
pconf.Timers.Config.MinimumAdvertisementInterval = float64(a.Timers.Config.MinimumAdvertisementInterval)
pconf.Timers.Config.IdleHoldTimeAfterReset = float64(a.Timers.Config.IdleHoldTimeAfterReset)
}
if a.Timers.State != nil {
pconf.Timers.State.KeepaliveInterval = float64(a.Timers.State.KeepaliveInterval)
Expand Down Expand Up @@ -806,6 +807,7 @@ func newPeerGroupFromAPIStruct(a *api.PeerGroup) (*config.PeerGroup, error) {
pconf.Timers.Config.HoldTime = float64(a.Timers.Config.HoldTime)
pconf.Timers.Config.KeepaliveInterval = float64(a.Timers.Config.KeepaliveInterval)
pconf.Timers.Config.MinimumAdvertisementInterval = float64(a.Timers.Config.MinimumAdvertisementInterval)
pconf.Timers.Config.IdleHoldTimeAfterReset = float64(a.Timers.Config.IdleHoldTimeAfterReset)
}
if a.Timers.State != nil {
pconf.Timers.State.KeepaliveInterval = float64(a.Timers.State.KeepaliveInterval)
Expand Down
8 changes: 5 additions & 3 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3246,15 +3246,17 @@ func (s *BgpServer) UpdatePeerGroup(ctx context.Context, r *api.UpdatePeerGroupR
}

func (s *BgpServer) updateNeighbor(c *config.Neighbor) (needsSoftResetIn bool, err error) {
var pgConf *config.PeerGroup
if c.Config.PeerGroup != "" {
if pg, ok := s.peerGroupMap[c.Config.PeerGroup]; ok {
if err := config.SetDefaultNeighborConfigValues(c, pg.Conf, &s.bgpConfig.Global); err != nil {
return needsSoftResetIn, err
}
pgConf = pg.Conf
} else {
return needsSoftResetIn, fmt.Errorf("no such peer-group: %s", c.Config.PeerGroup)
}
}
if err := config.SetDefaultNeighborConfigValues(c, pgConf, &s.bgpConfig.Global); err != nil {
return needsSoftResetIn, err
}

addr, err := c.ExtractNeighborAddress()
if err != nil {
Expand Down

0 comments on commit f8c6d24

Please sign in to comment.