From 72094dfceeaa083e1e59ed9a64dc12cede4ad43e Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Wed, 24 Jul 2019 09:00:52 -0600 Subject: 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. --- cmd/gobgpd/main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'cmd/gobgpd') 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) } -- cgit v1.2.3