From 43704901384fe35785383b27a1ad0bd7d430830c Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 7 Apr 2020 11:48:03 +0300 Subject: [PATCH] - dhcp: web handlers were not registered when DHCP server is disabled So there was no way to enable DHCP from UI --- dhcpd/dhcpd.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dhcpd/dhcpd.go b/dhcpd/dhcpd.go index b40a8ae8..2a4cf959 100644 --- a/dhcpd/dhcpd.go +++ b/dhcpd/dhcpd.go @@ -124,6 +124,11 @@ func Create(config ServerConfig) *Server { } } + if !webHandlersRegistered && s.conf.HTTPRegister != nil { + webHandlersRegistered = true + s.registerHandlers() + } + // we can't delay database loading until DHCP server is started, // because we need static leases functionality available beforehand s.dbLoad() @@ -219,12 +224,6 @@ func (s *Server) setConfig(config ServerConfig) error { // Start will listen on port 67 and serve DHCP requests. func (s *Server) Start() error { - - if !webHandlersRegistered && s.conf.HTTPRegister != nil { - webHandlersRegistered = true - s.registerHandlers() - } - // TODO: don't close if interface and addresses are the same if s.conn != nil { s.closeConn()