diff --git a/Makefile b/Makefile index e066a25..9b140ce 100755 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ clean: ## clean cache ## prepare environment update: git submodule init - git submodule update + git submodule update --remote vendor: go clean -modcache diff --git a/pkg/config/switch.go b/pkg/config/switch.go index 9caeee3..17706ac 100755 --- a/pkg/config/switch.go +++ b/pkg/config/switch.go @@ -153,12 +153,13 @@ func (s *Switch) Format() { for _, obj := range s.Network { context := obj.Specifies obj.NewSpecifies() - if data, err := libol.Marshal(context, true); err == nil { - if err := libol.Unmarshal(obj.Specifies, data); err != nil { - libol.Warn("Switch.Format %s", err) - } else { - libol.Info("Switch.Format %v", obj.Specifies) - } + if obj.Specifies == nil { + continue + } + if data, err := libol.Marshal(context, true); err != nil { + libol.Warn("Switch.Format %s", err) + } else if err := libol.Unmarshal(obj.Specifies, data); err != nil { + libol.Warn("Switch.Format %s", err) } } } diff --git a/pkg/switch/openlan.go b/pkg/switch/openlan.go index e5c6141..99770dc 100755 --- a/pkg/switch/openlan.go +++ b/pkg/switch/openlan.go @@ -39,7 +39,7 @@ func NewOpenLANWorker(c *co.Network) *OpenLANWorker { } func (w *OpenLANWorker) updateVPN() { - cfg, vpn := w.GetCfgs() + _, vpn := w.GetCfgs() if vpn == nil { return } @@ -47,7 +47,7 @@ func (w *OpenLANWorker) updateVPN() { routes := vpn.Routes routes = append(routes, vpn.Subnet) if addr := w.Subnet(); addr != "" { - libol.Info("OpenLANWorker.updateVPN %s subnet %s", cfg.Name, addr) + w.out.Info("OpenLANWorker.updateVPN subnet %s", addr) routes = append(routes, addr) } diff --git a/pkg/switch/router.go b/pkg/switch/router.go index 26e8235..5b7add4 100755 --- a/pkg/switch/router.go +++ b/pkg/switch/router.go @@ -33,6 +33,7 @@ func (w *RouterWorker) updateVPN() { routes := vpn.Routes routes = append(routes, vpn.Subnet) for _, sub := range spec.Subnets { + w.out.Info("RouterWorker.updateVPN subnet %s", sub.CIDR) routes = append(routes, sub.CIDR) }