Skip to content

Commit

Permalink
Move types not used by zedrouter out of zedroutertypes.go
Browse files Browse the repository at this point in the history
zedroutertypes.go currently contains all types related to networking,
including those which are actually used from NIM. This makes the file
very long and hard to work with. In this commit, we take types not used
from zedrouter out of zedroutertypes.go and move them into separate Go
files. Apart from moving type definitions and their methods around,
there are no actual code changes made here.

Signed-off-by: Milan Lenco <milan@zededa.com>
  • Loading branch information
milan-zededa authored and eriknordmark committed Oct 24, 2023
1 parent 745dfa2 commit 67cb511
Show file tree
Hide file tree
Showing 25 changed files with 2,424 additions and 2,402 deletions.
6 changes: 3 additions & 3 deletions pkg/pillar/cmd/diag/diag.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ func printOutput(ctx *diagContext, caller string) {
}
ctx.ph.Print("\n")
// If static print static config
if port.Dhcp == types.DT_STATIC {
if port.Dhcp == types.DhcpTypeStatic {
ctx.ph.Print("INFO: %s: Static IP subnet: %s\n",
ifname, port.Subnet.String())
for _, r := range port.DefaultRouters {
Expand Down Expand Up @@ -1100,7 +1100,7 @@ func printProxy(ctx *diagContext, port types.NetworkPortStatus,
} else {
for _, proxy := range port.ProxyConfig.Proxies {
switch proxy.Type {
case types.NPT_HTTP:
case types.NetworkProxyTypeHTTP:
var httpProxy string
if proxy.Port > 0 {
httpProxy = fmt.Sprintf("%s:%d", proxy.Server, proxy.Port)
Expand All @@ -1109,7 +1109,7 @@ func printProxy(ctx *diagContext, port types.NetworkPortStatus,
}
ctx.ph.Print("INFO: %s: http proxy %s\n",
ifname, httpProxy)
case types.NPT_HTTPS:
case types.NetworkProxyTypeHTTPS:
var httpsProxy string
if proxy.Port > 0 {
httpsProxy = fmt.Sprintf("%s:%d", proxy.Server, proxy.Port)
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/cmd/nim/nim.go
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ func (n *nim) makeLastResortDPC() (types.DevicePortConfig, error) {
IsMgmt: true,
IsL3Port: true,
DhcpConfig: types.DhcpConfig{
Dhcp: types.DT_CLIENT,
Dhcp: types.DhcpTypeClient,
},
}
dns := n.dpcManager.GetDNS()
Expand Down
56 changes: 28 additions & 28 deletions pkg/pillar/cmd/zedagent/parseconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,12 @@ func parseDnsNameToIpList(
apiConfigEntry *zconfig.NetworkInstanceConfig,
config *types.NetworkInstanceConfig) {

// Parse and store DnsNameToIPList form Network configuration
// Parse and store DNSNameToIPList form Network configuration
dnsEntries := apiConfigEntry.GetDns()

// Parse and populate the DnsNameToIP list
// Parse and populate the DNSNameToIP list
// This is what we will publish to zedrouter
nameToIPs := []types.DnsNameToIP{}
nameToIPs := []types.DNSNameToIP{}
for _, dnsEntry := range dnsEntries {
hostName := dnsEntry.HostName

Expand All @@ -404,7 +404,7 @@ func parseDnsNameToIpList(
}
}

nameToIP := types.DnsNameToIP{
nameToIP := types.DNSNameToIP{
HostName: hostName,
IPs: ips,
}
Expand Down Expand Up @@ -1122,7 +1122,7 @@ func parseOneSystemAdapterConfig(getconfigCtx *getconfigContext,

port.IsMgmt = isMgmt
port.Cost = portCost
port.Dhcp = types.DT_NONE
port.Dhcp = types.DhcpTypeNone
var ip net.IP
var network *types.NetworkXObjectConfig
if sysAdapter.Addr != "" {
Expand Down Expand Up @@ -1174,27 +1174,27 @@ func parseOneSystemAdapterConfig(getconfigCtx *getconfigContext,
port.WirelessCfg = network.WirelessCfg
port.Gateway = network.Gateway
port.DomainName = network.DomainName
port.NtpServer = network.NtpServer
port.DnsServers = network.DnsServers
port.NTPServer = network.NTPServer
port.DNSServers = network.DNSServers
// Need to be careful since zedcloud can feed us bad Dhcp type
port.Dhcp = network.Dhcp
switch port.Dhcp {
case types.DT_STATIC:
case types.DhcpTypeStatic:
if port.AddrSubnet == "" {
errStr := fmt.Sprintf("Port %s Configured as DT_STATIC but "+
errStr := fmt.Sprintf("Port %s Configured as DhcpTypeStatic but "+
"missing subnet address. SysAdapter - Name: %s, Addr:%s",
port.Logicallabel, sysAdapter.Name, sysAdapter.Addr)
log.Errorf("parseSystemAdapterConfig: %s", errStr)
port.RecordFailure(errStr)
}
case types.DT_CLIENT:
case types.DhcpTypeClient:
// Do nothing
case types.DT_NONE:
case types.DhcpTypeNone:
if isMgmt {
errStr := fmt.Sprintf("Port %s configured as Management port "+
"with an unsupported DHCP type %d. Client and static are "+
"the only allowed DHCP modes for management ports.",
port.Logicallabel, types.DT_NONE)
port.Logicallabel, types.DhcpTypeNone)

log.Errorf("parseSystemAdapterConfig: %s", errStr)
port.RecordFailure(errStr)
Expand Down Expand Up @@ -1774,13 +1774,13 @@ func parseOneNetworkXObjectConfig(ctx *getconfigContext, netEnt *zconfig.Network
}
switch proxy.Proto {
case zconfig.ProxyProto_PROXY_HTTP:
proxyEntry.Type = types.NPT_HTTP
proxyEntry.Type = types.NetworkProxyTypeHTTP
case zconfig.ProxyProto_PROXY_HTTPS:
proxyEntry.Type = types.NPT_HTTPS
proxyEntry.Type = types.NetworkProxyTypeHTTPS
case zconfig.ProxyProto_PROXY_SOCKS:
proxyEntry.Type = types.NPT_SOCKS
proxyEntry.Type = types.NetworkProxyTypeSOCKS
case zconfig.ProxyProto_PROXY_FTP:
proxyEntry.Type = types.NPT_FTP
proxyEntry.Type = types.NetworkProxyTypeFTP
default:
}
proxyConfig.Proxies = append(proxyConfig.Proxies, proxyEntry)
Expand All @@ -1796,7 +1796,7 @@ func parseOneNetworkXObjectConfig(ctx *getconfigContext, netEnt *zconfig.Network

ipspec := netEnt.GetIp()
switch config.Type {
case types.NT_IPV4, types.NT_IPV6:
case types.NetworkTypeIPv4, types.NetworkTypeIPV6:
if ipspec == nil {
errStr := fmt.Sprintf("parseOneNetworkXObjectConfig: Missing ipspec for %s in %v",
config.Key(), netEnt)
Expand All @@ -1812,10 +1812,10 @@ func parseOneNetworkXObjectConfig(ctx *getconfigContext, netEnt *zconfig.Network
config.SetErrorNow(errStr)
return config
}
case types.NT_NOOP:
// XXX is controller still sending static and dynamic entries with NT_NOOP? Why?
case types.NetworkTypeNOOP:
// XXX is controller still sending static and dynamic entries with NetworkTypeNOOP? Why?
if ipspec != nil {
log.Warnf("XXX NT_NOOP for %s with ipspec %v",
log.Warnf("XXX NetworkTypeNOOP for %s with ipspec %v",
config.Key(), ipspec)
err := parseIpspecNetworkXObject(ipspec, config)
if err != nil {
Expand All @@ -1835,12 +1835,12 @@ func parseOneNetworkXObjectConfig(ctx *getconfigContext, netEnt *zconfig.Network
return config
}

// Parse and store DnsNameToIPList form Network configuration
// Parse and store DNSNameToIPList form Network configuration
dnsEntries := netEnt.GetDns()

// Parse and populate the DnsNameToIP list
// Parse and populate the DNSNameToIP list
// This is what we will publish to zedrouter
nameToIPs := []types.DnsNameToIP{}
nameToIPs := []types.DNSNameToIP{}
for _, dnsEntry := range dnsEntries {
hostName := dnsEntry.HostName

Expand All @@ -1858,13 +1858,13 @@ func parseOneNetworkXObjectConfig(ctx *getconfigContext, netEnt *zconfig.Network
}
}

nameToIP := types.DnsNameToIP{
nameToIP := types.DNSNameToIP{
HostName: hostName,
IPs: ips,
}
nameToIPs = append(nameToIPs, nameToIP)
}
config.DnsNameToIPList = nameToIPs
config.DNSNameToIPList = nameToIPs
return config
}

Expand Down Expand Up @@ -2000,8 +2000,8 @@ func parseIpspecNetworkXObject(ipspec *zconfig.Ipspec, config *types.NetworkXObj
}
}
if n := ipspec.GetNtp(); n != "" {
config.NtpServer = net.ParseIP(n)
if config.NtpServer == nil {
config.NTPServer = net.ParseIP(n)
if config.NTPServer == nil {
return errors.New(fmt.Sprintf("bad ntp IP %s",
n))
}
Expand All @@ -2012,7 +2012,7 @@ func parseIpspecNetworkXObject(ipspec *zconfig.Ipspec, config *types.NetworkXObj
return errors.New(fmt.Sprintf("bad dns IP %s",
dsStr))
}
config.DnsServers = append(config.DnsServers, ds)
config.DNSServers = append(config.DNSServers, ds)
}
if dr := ipspec.GetDhcpRange(); dr != nil && dr.GetStart() != "" {
start := net.ParseIP(dr.GetStart())
Expand Down
60 changes: 30 additions & 30 deletions pkg/pillar/cmd/zedagent/parseconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ func TestParsePhysicalNetworkAdapters(t *testing.T) {
g.Expect(port.IsL3Port).To(BeTrue())
g.Expect(port.NetworkUUID.String()).To(Equal(networkUUID))
g.Expect(port.Cost).To(BeZero())
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_IPV4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_CLIENT))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeIPv4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeClient))
g.Expect(port.DhcpConfig.DomainName).To(BeEmpty())
g.Expect(port.DhcpConfig.AddrSubnet).To(BeEmpty())
g.Expect(port.DhcpConfig.DnsServers).To(BeEmpty())
g.Expect(port.DhcpConfig.DNSServers).To(BeEmpty())
g.Expect(port.DhcpConfig.Gateway).To(BeNil())
g.Expect(port.DhcpConfig.NtpServer).To(BeNil())
g.Expect(port.DhcpConfig.NTPServer).To(BeNil())
g.Expect(port.ProxyConfig.Proxies).To(BeEmpty())
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeNone))
g.Expect(port.WirelessCfg.WType).To(Equal(types.WirelessTypeNone))
Expand Down Expand Up @@ -330,8 +330,8 @@ func TestParseVlans(t *testing.T) {
g.Expect(port.IfName).To(Equal("shopfloor.100"))
g.Expect(port.NetworkUUID.String()).To(Equal(network1UUID))
g.Expect(port.Cost).To(BeEquivalentTo(10))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_IPV4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_CLIENT))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeIPv4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeClient))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeVLAN))
g.Expect(port.L2LinkConfig.VLAN.ParentPort).To(Equal("shopfloor"))
g.Expect(port.L2LinkConfig.VLAN.ID).To(BeEquivalentTo(100))
Expand All @@ -344,8 +344,8 @@ func TestParseVlans(t *testing.T) {
g.Expect(port.IfName).To(Equal("shopfloor.200"))
g.Expect(port.NetworkUUID.String()).To(Equal(network2UUID))
g.Expect(port.Cost).To(BeEquivalentTo(20))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_IPV6))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_CLIENT))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeIPV6))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeClient))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeVLAN))
g.Expect(port.L2LinkConfig.VLAN.ParentPort).To(Equal("shopfloor"))
g.Expect(port.L2LinkConfig.VLAN.ID).To(BeEquivalentTo(200))
Expand All @@ -358,8 +358,8 @@ func TestParseVlans(t *testing.T) {
g.Expect(port.IfName).To(Equal("eth0"))
g.Expect(port.NetworkUUID).To(BeZero())
g.Expect(port.Cost).To(BeZero())
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_NOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_NOOP))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeNOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeNOOP))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeNone))
g.Expect(port.WirelessCfg.WType).To(Equal(types.WirelessTypeNone))

Expand Down Expand Up @@ -389,8 +389,8 @@ func TestParseVlans(t *testing.T) {
g.Expect(port.IfName).To(Equal("warehouse.100"))
g.Expect(port.NetworkUUID.String()).To(Equal(network3UUID))
g.Expect(port.Cost).To(BeEquivalentTo(30))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_IPV4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_STATIC))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeIPv4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeStatic))
g.Expect(port.DhcpConfig.AddrSubnet).To(Equal("192.168.1.150/24"))
g.Expect(port.DhcpConfig.Gateway.String()).To(Equal("192.168.1.1"))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeVLAN))
Expand All @@ -405,8 +405,8 @@ func TestParseVlans(t *testing.T) {
g.Expect(port.IfName).To(Equal("eth1"))
g.Expect(port.NetworkUUID).To(BeZero())
g.Expect(port.Cost).To(BeZero())
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_NOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_NOOP))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeNOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeNOOP))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeNone))
g.Expect(port.WirelessCfg.WType).To(Equal(types.WirelessTypeNone))
}
Expand Down Expand Up @@ -496,8 +496,8 @@ func TestParseBonds(t *testing.T) {
g.Expect(port.IfName).To(Equal("bond0"))
g.Expect(port.NetworkUUID.String()).To(Equal(networkUUID))
g.Expect(port.Cost).To(BeEquivalentTo(10))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_IPV4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_CLIENT))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeIPv4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeClient))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeBond))
g.Expect(port.L2LinkConfig.Bond.AggregatedPorts).To(Equal([]string{"shopfloor1", "shopfloor0"}))
g.Expect(port.L2LinkConfig.Bond.Mode).To(Equal(types.BondModeActiveBackup))
Expand All @@ -515,8 +515,8 @@ func TestParseBonds(t *testing.T) {
g.Expect(port.IfName).To(Equal("eth0"))
g.Expect(port.NetworkUUID).To(BeZero())
g.Expect(port.Cost).To(BeZero())
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_NOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_NOOP))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeNOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeNOOP))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeNone))
g.Expect(port.WirelessCfg.WType).To(Equal(types.WirelessTypeNone))
// underlying physical "shopfloor1" adapter
Expand All @@ -527,8 +527,8 @@ func TestParseBonds(t *testing.T) {
g.Expect(port.IfName).To(Equal("eth1"))
g.Expect(port.NetworkUUID).To(BeZero())
g.Expect(port.Cost).To(BeZero())
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_NOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_NOOP))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeNOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeNOOP))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeNone))
g.Expect(port.WirelessCfg.WType).To(Equal(types.WirelessTypeNone))
}
Expand Down Expand Up @@ -651,8 +651,8 @@ func TestParseVlansOverBonds(t *testing.T) {
g.Expect(port.IfName).To(Equal("shopfloor.100"))
g.Expect(port.NetworkUUID.String()).To(Equal(network1UUID))
g.Expect(port.Cost).To(BeEquivalentTo(10))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_IPV4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_CLIENT))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeIPv4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeClient))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeVLAN))
g.Expect(port.L2LinkConfig.VLAN.ParentPort).To(Equal("bond-shopfloor"))
g.Expect(port.L2LinkConfig.VLAN.ID).To(BeEquivalentTo(100))
Expand All @@ -666,8 +666,8 @@ func TestParseVlansOverBonds(t *testing.T) {
g.Expect(port.IfName).To(Equal("shopfloor.200"))
g.Expect(port.NetworkUUID.String()).To(Equal(network2UUID))
g.Expect(port.Cost).To(BeEquivalentTo(20))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_IPV4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_CLIENT))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeIPv4))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeClient))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeVLAN))
g.Expect(port.L2LinkConfig.VLAN.ParentPort).To(Equal("bond-shopfloor"))
g.Expect(port.L2LinkConfig.VLAN.ID).To(BeEquivalentTo(200))
Expand All @@ -681,8 +681,8 @@ func TestParseVlansOverBonds(t *testing.T) {
g.Expect(port.IfName).To(Equal("bond0"))
g.Expect(port.NetworkUUID).To(BeZero())
g.Expect(port.Cost).To(BeZero())
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_NOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_NOOP))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeNOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeNOOP))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeBond))
g.Expect(port.L2LinkConfig.Bond.AggregatedPorts).To(Equal([]string{"shopfloor1", "shopfloor0"}))
g.Expect(port.L2LinkConfig.Bond.Mode).To(Equal(types.BondModeActiveBackup))
Expand All @@ -701,8 +701,8 @@ func TestParseVlansOverBonds(t *testing.T) {
g.Expect(port.IfName).To(Equal("eth0"))
g.Expect(port.NetworkUUID).To(BeZero())
g.Expect(port.Cost).To(BeZero())
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_NOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_NOOP))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeNOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeNOOP))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeNone))
g.Expect(port.WirelessCfg.WType).To(Equal(types.WirelessTypeNone))
// underlying physical "shopfloor1" adapter
Expand All @@ -714,8 +714,8 @@ func TestParseVlansOverBonds(t *testing.T) {
g.Expect(port.IfName).To(Equal("eth1"))
g.Expect(port.NetworkUUID).To(BeZero())
g.Expect(port.Cost).To(BeZero())
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NT_NOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DT_NOOP))
g.Expect(port.DhcpConfig.Type).To(BeEquivalentTo(types.NetworkTypeNOOP))
g.Expect(port.DhcpConfig.Dhcp).To(Equal(types.DhcpTypeNOOP))
g.Expect(port.L2LinkConfig.L2Type).To(Equal(types.L2LinkTypeNone))
g.Expect(port.WirelessCfg.WType).To(Equal(types.WirelessTypeNone))
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/pillar/cmd/zedagent/reportinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ func encodeNetworkPortStatus(ctx *zedagentContext,
for _, router := range port.DefaultRouters {
devicePort.DefaultRouters = append(devicePort.DefaultRouters, router.String())
}
// devicePort.DnsServers is deprecated - replaced by Dns
// devicePort.DNSServers is deprecated - replaced by Dns
devicePort.Dns = new(info.ZInfoDNS)
devicePort.Dns.DNSdomain = port.DomainName
for _, dnsServer := range port.DNSServers {
Expand Down Expand Up @@ -1146,12 +1146,12 @@ func encodeNetworkPortConfig(ctx *zedagentContext,
dp.DefaultRouters = make([]string, 0)
dp.DefaultRouters = append(dp.DefaultRouters, npc.Gateway.String())

dp.NtpServer = npc.NtpServer.String()
dp.NtpServer = npc.NTPServer.String()

dp.Dns = new(info.ZInfoDNS)
dp.Dns.DNSdomain = npc.DomainName
dp.Dns.DNSservers = make([]string, 0)
for _, d := range npc.DnsServers {
for _, d := range npc.DNSServers {
dp.Dns.DNSservers = append(dp.Dns.DNSservers, d.String())
}
// XXX Not in definition. Remove?
Expand Down
Loading

0 comments on commit 67cb511

Please sign in to comment.