/install/configure -- Start DNS server explicitly

This commit is contained in:
Eugene Bujak 2019-02-01 19:42:33 +03:00
parent daae040f9c
commit 5abe5af707
1 changed files with 10 additions and 2 deletions

View File

@ -767,12 +767,12 @@ func handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
// validate that hosts and ports are bindable
if !checkPortAvailable(newSettings.Web.IP, newSettings.Web.Port) {
httpError(w, http.StatusBadRequest, "Impossible to listen on IP:port %s:%d", newSettings.Web.IP, newSettings.Web.Port)
httpError(w, http.StatusBadRequest, "Impossible to listen on IP:port %s", net.JoinHostPort(newSettings.Web.IP, strconv.Itoa(newSettings.Web.Port)))
return
}
if !checkPacketPortAvailable(newSettings.DNS.IP, newSettings.DNS.Port) {
httpError(w, http.StatusBadRequest, "Impossible to listen on IP:port %s:%d", newSettings.DNS.IP, newSettings.DNS.Port)
httpError(w, http.StatusBadRequest, "Impossible to listen on IP:port %s", net.JoinHostPort(newSettings.DNS.IP, strconv.Itoa(newSettings.DNS.Port)))
return
}
@ -784,6 +784,14 @@ func handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
config.AuthName = newSettings.Username
config.AuthPass = newSettings.Password
if config.DNS.Port != 0 {
err = startDNSServer()
if err != nil {
httpError(w, http.StatusInternalServerError, "Couldn't start DNS server: %s", err)
return
}
}
httpUpdateConfigReloadDNSReturnOK(w, r)
}