summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/config
diff options
context:
space:
mode:
authorHitoshi Irino <irino@sfc.wide.ad.jp>2018-12-29 21:53:10 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2018-12-30 21:52:15 +0900
commit4e862fa8f0017383ecdae22c757753214ba7815c (patch)
tree62700c8b24d6d5c234729d4cd89b6b0384ad9ade /internal/pkg/config
parent67947eeda62ff961208b19f29c652399dd93ea97 (diff)
zebra: Introducing MIN_ZAPIVER and MAX_ZAPIVER. And avoiding double close channel when sequential retry to connect zebra.
- Introducing MIN_ZAPIVER and MAX_ZAPIVER for avoiding editing files except for zapi.go when new ZAPI version will be supported in future. - Fix a bug avoiding panic by double close for a channel. - Changing algorithm for sequential retry to connect zebra.
Diffstat (limited to 'internal/pkg/config')
-rw-r--r--internal/pkg/config/default.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/pkg/config/default.go b/internal/pkg/config/default.go
index 08f9f865..13e1267c 100644
--- a/internal/pkg/config/default.go
+++ b/internal/pkg/config/default.go
@@ -8,6 +8,7 @@ import (
"reflect"
"strconv"
+ "github.com/osrg/gobgp/internal/pkg/zebra"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/pkg/packet/bmp"
"github.com/osrg/gobgp/pkg/packet/rtr"
@@ -400,10 +401,10 @@ func setDefaultConfigValuesWithViper(v *viper.Viper, b *BgpConfigSet) error {
if b.Zebra.Config.Url == "" {
b.Zebra.Config.Url = "unix:/var/run/quagga/zserv.api"
}
- if b.Zebra.Config.Version < 2 {
- b.Zebra.Config.Version = 2
- } else if b.Zebra.Config.Version > 6 {
- b.Zebra.Config.Version = 6
+ if b.Zebra.Config.Version < zebra.MinZapiVer {
+ b.Zebra.Config.Version = zebra.MinZapiVer
+ } else if b.Zebra.Config.Version > zebra.MaxZapiVer {
+ b.Zebra.Config.Version = zebra.MaxZapiVer
}
if !v.IsSet("zebra.config.nexthop-trigger-enable") && !b.Zebra.Config.NexthopTriggerEnable && b.Zebra.Config.Version > 2 {
b.Zebra.Config.NexthopTriggerEnable = true