From 455f5b76169515dcc36cf4d7c1d51ead3be02e1f Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Tue, 24 Sep 2019 21:45:48 +0200 Subject: vendor: updated ocicni for MAC address `go get github.com/cri-o/ocicni@deac903fd99b6c52d781c9f42b8db3af7dcfd00a` I had to fix compilation errors in libpod/networking_linux.go --- ocicni.Networks has changed from string to the structure NetAttachment with the member Name (the former string value) and the member Ifname (optional). I don't think we can make use of Ifname here, so I just map the array of structures to array of strings - e.g. dropping Ifname. --- The function GetPodNetworkStatus no longer returns Result but it returns the wrapper structure NetResult which contains the former Result plus NetAttachment (Network name and Interface name). Again, I don't think we can make use of that information here, so I just added `.Result` to fix the build. --- Issue: #1136 Signed-off-by: Jakub Filak --- libpod/networking_linux.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'libpod') diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index ac1144fbe..8172e3fb2 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -35,17 +35,21 @@ func (r *Runtime) getPodNetwork(id, name, nsPath string, networks []string, port Namespace: name, // TODO is there something else we should put here? We don't know about Kube namespaces ID: id, NetNS: nsPath, - Networks: networks, RuntimeConfig: map[string]ocicni.RuntimeConfig{ defaultNetwork: {PortMappings: ports}, }, } if staticIP != nil { - network.Networks = []string{defaultNetwork} + network.Networks = []ocicni.NetAttachment{{Name: defaultNetwork}} network.RuntimeConfig = map[string]ocicni.RuntimeConfig{ defaultNetwork: {IP: staticIP.String(), PortMappings: ports}, } + } else { + network.Networks = make([]ocicni.NetAttachment, len(networks)) + for i, netName := range networks { + network.Networks[i].Name = netName + } } return network @@ -78,10 +82,10 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) ([]*cnitypes.Re networkStatus := make([]*cnitypes.Result, 0) for idx, r := range results { - logrus.Debugf("[%d] CNI result: %v", idx, r.String()) - resultCurrent, err := cnitypes.GetResult(r) + logrus.Debugf("[%d] CNI result: %v", idx, r.Result.String()) + resultCurrent, err := cnitypes.GetResult(r.Result) if err != nil { - return nil, errors.Wrapf(err, "error parsing CNI plugin result %q: %v", r.String(), err) + return nil, errors.Wrapf(err, "error parsing CNI plugin result %q: %v", r.Result.String(), err) } networkStatus = append(networkStatus, resultCurrent) } -- cgit v1.2.3-54-g00ecf