summaryrefslogtreecommitdiffhomepage
path: root/cmd/gobgpd/main.go
diff options
context:
space:
mode:
authorCarl Baldwin <carl@ecbaldwin.net>2019-07-24 09:00:52 -0600
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-08-28 09:06:20 +0900
commit72094dfceeaa083e1e59ed9a64dc12cede4ad43e (patch)
treeb89721c2c24c8a1582d8ebbe009f7900f7226709 /cmd/gobgpd/main.go
parentbf2df3ec6f5fb419dd5ba66d15e16d91decb264c (diff)
Use newConfig more consistently when apply initial configuration
This block of code has for loops that shadow the variable `c` declared above it. This commit makes the scoping a little clearer by using newConfig where possible to avoid the ambiguity.
Diffstat (limited to 'cmd/gobgpd/main.go')
-rw-r--r--cmd/gobgpd/main.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go
index 7ad06434..569c2daa 100644
--- a/cmd/gobgpd/main.go
+++ b/cmd/gobgpd/main.go
@@ -238,25 +238,25 @@ func main() {
if c == nil {
c = newConfig
if err := bgpServer.StartBgp(context.Background(), &api.StartBgpRequest{
- Global: config.NewGlobalFromConfigStruct(&c.Global),
+ Global: config.NewGlobalFromConfigStruct(&newConfig.Global),
}); err != nil {
log.Fatalf("failed to set global config: %s", err)
}
if newConfig.Zebra.Config.Enabled {
- tps := c.Zebra.Config.RedistributeRouteTypeList
+ tps := newConfig.Zebra.Config.RedistributeRouteTypeList
l := make([]string, 0, len(tps))
for _, t := range tps {
l = append(l, string(t))
}
if err := bgpServer.EnableZebra(context.Background(), &api.EnableZebraRequest{
- Url: c.Zebra.Config.Url,
+ Url: newConfig.Zebra.Config.Url,
RouteTypes: l,
- Version: uint32(c.Zebra.Config.Version),
- NexthopTriggerEnable: c.Zebra.Config.NexthopTriggerEnable,
- NexthopTriggerDelay: uint32(c.Zebra.Config.NexthopTriggerDelay),
- MplsLabelRangeSize: uint32(c.Zebra.Config.MplsLabelRangeSize),
- SoftwareName: c.Zebra.Config.SoftwareName,
+ Version: uint32(newConfig.Zebra.Config.Version),
+ NexthopTriggerEnable: newConfig.Zebra.Config.NexthopTriggerEnable,
+ NexthopTriggerDelay: uint32(newConfig.Zebra.Config.NexthopTriggerDelay),
+ MplsLabelRangeSize: uint32(newConfig.Zebra.Config.MplsLabelRangeSize),
+ SoftwareName: newConfig.Zebra.Config.SoftwareName,
}); err != nil {
log.Fatalf("failed to set zebra config: %s", err)
}