* dhcp: fail on startup if couldn't initialize DHCP module
This commit is contained in:
parent
a3317c08c4
commit
89c3926ba5
|
@ -119,6 +119,11 @@ func Create(config ServerConfig) *Server {
|
|||
return nil
|
||||
}
|
||||
|
||||
if s.conf.Enabled && !v4conf.Enabled && !v6conf.Enabled {
|
||||
log.Error("Can't enable DHCP server because neither DHCPv4 nor DHCPv6 servers are configured")
|
||||
return nil
|
||||
}
|
||||
|
||||
// we can't delay database loading until DHCP server is started,
|
||||
// because we need static leases functionality available beforehand
|
||||
s.dbLoad()
|
||||
|
|
|
@ -221,6 +221,9 @@ func run(args options) {
|
|||
config.DHCP.ConfigModified = onConfigModified
|
||||
if runtime.GOOS != "windows" {
|
||||
Context.dhcpServer = dhcpd.Create(config.DHCP)
|
||||
if Context.dhcpServer == nil {
|
||||
log.Fatalf("Can't initialize DHCP module")
|
||||
}
|
||||
}
|
||||
Context.autoHosts.Init("")
|
||||
|
||||
|
|
Loading…
Reference in New Issue