+ control: /install/*: test TCP port availability for DNS server

This commit is contained in:
Simon Zolin 2019-04-17 12:03:51 +03:00
parent 8d936b5756
commit 87147ac89f
1 changed files with 11 additions and 2 deletions

View File

@ -1059,6 +1059,10 @@ func handleInstallCheckConfig(w http.ResponseWriter, r *http.Request) {
respData.DNS.CanAutofix = canAutofix respData.DNS.CanAutofix = canAutofix
} }
if err == nil {
err = checkPortAvailable(reqData.DNS.IP, reqData.DNS.Port)
}
if err != nil { if err != nil {
respData.DNS.Status = fmt.Sprintf("%v", err) respData.DNS.Status = fmt.Sprintf("%v", err)
} }
@ -1161,8 +1165,13 @@ func handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
err = checkPacketPortAvailable(newSettings.DNS.IP, newSettings.DNS.Port) err = checkPacketPortAvailable(newSettings.DNS.IP, newSettings.DNS.Port)
if err != nil { if err != nil {
httpError(w, http.StatusBadRequest, "Impossible to listen on IP:port %s due to %s", httpError(w, http.StatusBadRequest, "%s", err)
net.JoinHostPort(newSettings.DNS.IP, strconv.Itoa(newSettings.DNS.Port)), err) return
}
err = checkPortAvailable(newSettings.DNS.IP, newSettings.DNS.Port)
if err != nil {
httpError(w, http.StatusBadRequest, "%s", err)
return return
} }