From 626c1ae753749465107c4713b6a2dd7323761e83 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 14 May 2019 12:59:59 +0300 Subject: [PATCH] * control,dhcp: use dhcpServerConfigJSON struct --- dhcp.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dhcp.go b/dhcp.go index 4bd0c463..35c4d22f 100644 --- a/dhcp.go +++ b/dhcp.go @@ -47,9 +47,13 @@ func handleDHCPStatus(w http.ResponseWriter, r *http.Request) { } } +type dhcpServerConfigJSON struct { + dhcpd.ServerConfig `json:",inline"` +} + func handleDHCPSetConfig(w http.ResponseWriter, r *http.Request) { log.Tracef("%s %v", r.Method, r.URL) - newconfig := dhcpd.ServerConfig{} + newconfig := dhcpServerConfigJSON{} err := json.NewDecoder(r.Body).Decode(&newconfig) if err != nil { httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) @@ -72,14 +76,14 @@ func handleDHCPSetConfig(w http.ResponseWriter, r *http.Request) { } } - err = dhcpServer.Start(&newconfig) + err = dhcpServer.Start(&newconfig.ServerConfig) if err != nil { httpError(w, http.StatusBadRequest, "Failed to start DHCP server: %s", err) return } } - config.DHCP = newconfig + config.DHCP = newconfig.ServerConfig httpUpdateConfigReloadDNSReturnOK(w, r) }