* GET /control/dhcp/interfaces: remove 'mtu'; add 'gateway_ip'

This commit is contained in:
Simon Zolin 2020-08-10 12:43:38 +03:00
parent ec24d18f83
commit 6090400ea0
3 changed files with 5 additions and 8 deletions

View File

@ -442,10 +442,10 @@ Response:
{ {
"iface_name":{ "iface_name":{
"name":"iface_name", "name":"iface_name",
"mtu":1500,
"hardware_address":"...", "hardware_address":"...",
"ipv4_addresses":["ipv4 addr", ...], "ipv4_addresses":["ipv4 addr", ...],
"ipv6_addresses":["ipv6 addr", ...], "ipv6_addresses":["ipv6 addr", ...],
"gateway_ip":"...",
"flags":"up|broadcast|multicast" "flags":"up|broadcast|multicast"
} }
... ...

View File

@ -200,7 +200,7 @@ func (s *Server) handleDHCPSetConfig(w http.ResponseWriter, r *http.Request) {
type netInterfaceJSON struct { type netInterfaceJSON struct {
Name string `json:"name"` Name string `json:"name"`
MTU int `json:"mtu"` GatewayIP string `json:"gateway_ip"`
HardwareAddr string `json:"hardware_address"` HardwareAddr string `json:"hardware_address"`
Addrs4 []string `json:"ipv4_addresses"` Addrs4 []string `json:"ipv4_addresses"`
Addrs6 []string `json:"ipv6_addresses"` Addrs6 []string `json:"ipv6_addresses"`
@ -233,7 +233,6 @@ func (s *Server) handleDHCPInterfaces(w http.ResponseWriter, r *http.Request) {
jsonIface := netInterfaceJSON{ jsonIface := netInterfaceJSON{
Name: iface.Name, Name: iface.Name,
MTU: iface.MTU,
HardwareAddr: iface.HardwareAddr.String(), HardwareAddr: iface.HardwareAddr.String(),
} }
@ -259,9 +258,9 @@ func (s *Server) handleDHCPInterfaces(w http.ResponseWriter, r *http.Request) {
} }
} }
if len(jsonIface.Addrs4)+len(jsonIface.Addrs6) != 0 { if len(jsonIface.Addrs4)+len(jsonIface.Addrs6) != 0 {
jsonIface.GatewayIP = getGatewayIP(iface.Name)
response[iface.Name] = jsonIface response[iface.Name] = jsonIface
} }
} }
err = json.NewEncoder(w).Encode(response) err = json.NewEncoder(w).Encode(response)

View File

@ -1619,10 +1619,6 @@ components:
hardware_address: hardware_address:
type: string type: string
example: 52:54:00:11:09:ba example: 52:54:00:11:09:ba
mtu:
type: integer
format: int32
example: 1500
name: name:
type: string type: string
example: eth0 example: eth0
@ -1634,6 +1630,8 @@ components:
type: array type: array
items: items:
type: string type: string
gateway_ip:
type: string
AddressInfo: AddressInfo:
type: object type: object
description: Port information description: Port information