diff --git a/cmd/yggdrasil/main.go b/cmd/yggdrasil/main.go index 1760e384..e409f4ab 100644 --- a/cmd/yggdrasil/main.go +++ b/cmd/yggdrasil/main.go @@ -323,31 +323,10 @@ func main() { logger.Infof("Your IPv6 subnet is %s", subnet.String()) // Catch interrupts from the operating system to exit gracefully. c := make(chan os.Signal, 1) - r := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) - signal.Notify(r, os.Interrupt, syscall.SIGHUP) // Capture the service being stopped on Windows. minwinsvc.SetOnExit(n.shutdown) - defer n.shutdown() - // Wait for the terminate/interrupt signal. Once a signal is received, the - // deferred Stop function above will run which will shut down TUN/TAP. - for { - select { - case <-c: - goto exit - case <-r: - if *useconffile != "" { - cfg = readConfig(useconf, useconffile, normaliseconf) - logger.Infoln("Reloading configuration from", *useconffile) - n.core.UpdateConfig(cfg) - n.tuntap.UpdateConfig(cfg) - n.multicast.UpdateConfig(cfg) - } else { - logger.Errorln("Reloading config at runtime is only possible with -useconffile") - } - } - } -exit: + n.shutdown() } func (n *node) shutdown() { diff --git a/src/admin/admin.go b/src/admin/admin.go index a87e1248..83f330ed 100644 --- a/src/admin/admin.go +++ b/src/admin/admin.go @@ -8,6 +8,7 @@ import ( "net" "net/url" "os" + //"strconv" "strings" "time" @@ -70,17 +71,6 @@ func (a *AdminSocket) Init(c *yggdrasil.Core, state *config.NodeState, log *log. return nil } -func (a *AdminSocket) UpdateConfig(config *config.NodeConfig) { - a.log.Debugln("Reloading admin configuration...") - if a.listenaddr != config.AdminListen { - a.listenaddr = config.AdminListen - if a.IsStarted() { - a.Stop() - } - a.Start() - } -} - func (a *AdminSocket) SetupAdminHandlers(na *AdminSocket) { /* TODO a.AddHandler("getSelf", []string{}, func(in Info) (Info, error) { diff --git a/src/module/module.go b/src/module/module.go index ab704e70..24854e71 100644 --- a/src/module/module.go +++ b/src/module/module.go @@ -14,7 +14,6 @@ type Module interface { Init(core *yggdrasil.Core, state *config.NodeState, log *log.Logger, options interface{}) error Start() error Stop() error - UpdateConfig(config *config.NodeConfig) SetupAdminHandlers(a *admin.AdminSocket) IsStarted() bool } diff --git a/src/multicast/multicast.go b/src/multicast/multicast.go index 430e9374..6825776d 100644 --- a/src/multicast/multicast.go +++ b/src/multicast/multicast.go @@ -129,32 +129,6 @@ func (m *Multicast) _stop() error { return nil } -// UpdateConfig updates the multicast module with the provided config.NodeConfig -// and then signals the various module goroutines to reconfigure themselves if -// needed. -func (m *Multicast) UpdateConfig(config *config.NodeConfig) { - m.Act(nil, func() { m._updateConfig(config) }) -} - -func (m *Multicast) _updateConfig(config *config.NodeConfig) { - m.log.Infoln("Reloading multicast configuration...") - if m.isOpen { - if len(config.MulticastInterfaces) == 0 || config.LinkLocalTCPPort != m.listenPort { - if err := m._stop(); err != nil { - m.log.Errorln("Error stopping multicast module:", err) - } - } - } - m.config.Replace(*config) - m.listenPort = config.LinkLocalTCPPort - if !m.isOpen && len(config.MulticastInterfaces) > 0 { - if err := m._start(); err != nil { - m.log.Errorln("Error starting multicast module:", err) - } - } - m.log.Debugln("Reloaded multicast configuration successfully") -} - func (m *Multicast) _updateInterfaces() { interfaces := make(map[string]interfaceInfo) intfs := m.getAllowedInterfaces() diff --git a/src/tuntap/tun.go b/src/tuntap/tun.go index 2e44a017..1618506a 100644 --- a/src/tuntap/tun.go +++ b/src/tuntap/tun.go @@ -40,7 +40,6 @@ type TunAdapter struct { store keyStore config *config.NodeState log *log.Logger - reconfigure chan chan error addr address.Address subnet address.Subnet ckr cryptokey @@ -197,25 +196,6 @@ func (tun *TunAdapter) _stop() error { return nil } -// UpdateConfig updates the TUN module with the provided config.NodeConfig -// and then signals the various module goroutines to reconfigure themselves if -// needed. -func (tun *TunAdapter) UpdateConfig(config *config.NodeConfig) { - tun.log.Debugln("Reloading TUN configuration...") - - // Replace the active configuration with the supplied one - tun.config.Replace(*config) - - // If the MTU has changed in the TUN module then this is where we would - // tell the router so that updated session pings can be sent. However, we - // don't currently update the MTU of the adapter once it has been created so - // this doesn't actually happen in the real world yet. - // tun.core.SetMaximumSessionMTU(...) - - // Notify children about the configuration change - tun.Act(nil, tun.ckr.configure) -} - func (tun *TunAdapter) oobHandler(fromKey, toKey ed25519.PublicKey, data []byte) { if len(data) != 1+ed25519.SignatureSize { return diff --git a/src/yggdrasil/core.go b/src/yggdrasil/core.go index e3c992d3..0054db82 100644 --- a/src/yggdrasil/core.go +++ b/src/yggdrasil/core.go @@ -90,23 +90,6 @@ func (c *Core) _addPeerLoop() { }) } -// UpdateConfig updates the configuration in Core with the provided -// config.NodeConfig and then signals the various module goroutines to -// reconfigure themselves if needed. -func (c *Core) UpdateConfig(config *config.NodeConfig) { - c.Act(nil, func() { - c.log.Debugln("Reloading node configuration...") - - // Replace the active configuration with the supplied one - c.config.Replace(*config) - - // Notify the router and switch about the new configuration - panic("TODO") - //c.router.Act(c, c.router.reconfigure) - //c.switchTable.Act(c, c.switchTable.reconfigure) - }) -} - // Start starts up Yggdrasil using the provided config.NodeConfig, and outputs // debug logging through the provided log.Logger. The started stack will include // TCP and UDP sockets, a multicast discovery socket, an admin socket, router,