diff --git a/plugins/ipam/host-local/main.go b/plugins/ipam/host-local/main.go index 0f53574ea..c30932c2b 100644 --- a/plugins/ipam/host-local/main.go +++ b/plugins/ipam/host-local/main.go @@ -67,7 +67,7 @@ func cmdAdd(args *skel.CmdArgs) error { if err != nil { return err } - result.DNS = *dns + result.DNS = dns } store, err := disk.New(ipamConf.Name, ipamConf.DataDir) diff --git a/plugins/ipam/static/main.go b/plugins/ipam/static/main.go index bf541d2d6..deb074a53 100644 --- a/plugins/ipam/static/main.go +++ b/plugins/ipam/static/main.go @@ -263,7 +263,7 @@ func cmdAdd(args *skel.CmdArgs) error { result := ¤t.Result{ CNIVersion: current.ImplementedSpecVersion, - DNS: ipamConf.DNS, + DNS: &ipamConf.DNS, Routes: ipamConf.Routes, } for _, v := range ipamConf.Addresses { diff --git a/plugins/main/bridge/bridge.go b/plugins/main/bridge/bridge.go index f4e61c72d..badace646 100644 --- a/plugins/main/bridge/bridge.go +++ b/plugins/main/bridge/bridge.go @@ -734,7 +734,7 @@ func cmdAdd(args *skel.CmdArgs) error { // Use incoming DNS settings if provided, otherwise use the // settings that were already configued by the IPAM plugin - if dnsConfSet(n.DNS) { + if n.DNS != nil { result.DNS = n.DNS } @@ -743,13 +743,6 @@ func cmdAdd(args *skel.CmdArgs) error { return types.PrintResult(result, cniVersion) } -func dnsConfSet(dnsConf types.DNS) bool { - return dnsConf.Nameservers != nil || - dnsConf.Search != nil || - dnsConf.Options != nil || - dnsConf.Domain != "" -} - func cmdDel(args *skel.CmdArgs) error { n, _, err := loadNetConf(args.StdinData, args.Args) if err != nil { diff --git a/plugins/main/ptp/ptp.go b/plugins/main/ptp/ptp.go index 841e57d12..b6a81eba5 100644 --- a/plugins/main/ptp/ptp.go +++ b/plugins/main/ptp/ptp.go @@ -241,20 +241,13 @@ func cmdAdd(args *skel.CmdArgs) error { // Only override the DNS settings in the previous result if any DNS fields // were provided to the ptp plugin. This allows, for example, IPAM plugins // to specify the DNS settings instead of the ptp plugin. - if dnsConfSet(conf.DNS) { + if conf.DNS != nil { result.DNS = conf.DNS } return types.PrintResult(result, conf.CNIVersion) } -func dnsConfSet(dnsConf types.DNS) bool { - return dnsConf.Nameservers != nil || - dnsConf.Search != nil || - dnsConf.Options != nil || - dnsConf.Domain != "" -} - func cmdDel(args *skel.CmdArgs) error { conf := NetConf{} if err := json.Unmarshal(args.StdinData, &conf); err != nil {