Skip to content

Commit a4715e8

Browse files
committed
Prefix On NIC v6 Support
1 parent ba04ef9 commit a4715e8

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

azure-ipam/ipam.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,25 @@ func (p *IPAMPlugin) CmdAdd(args *cniSkel.CmdArgs) error {
151151
cniResult.IPs[i] = ipConfig
152152
}
153153

154-
p.logger.Info("MACAddress:", zap.Any("MACAddress", resp.PodIPInfo[0].MacAddress))
154+
cniResult.Interfaces = []*types100.Interface{}
155+
seenInterfaces := map[string]bool{}
155156

156-
cniResult.Interfaces = make([]*types100.Interface, 1)
157-
interface_test := &types100.Interface{
158-
Name: "eth1",
159-
//Mac: "00-0D-3A-6F-11-DE",
160-
Mac: resp.PodIPInfo[0].MacAddress,
157+
for _, podIPInfo := range resp.PodIPInfo {
158+
if seenInterfaces[podIPInfo.MacAddress] {
159+
continue
160+
}
161+
162+
infMac, err := net.ParseMAC(podIPInfo.MacAddress)
163+
if err != nil {
164+
p.logger.Error("Failed to parse interface MAC address", zap.Error(err), zap.String("macAddress", podIPInfo.MacAddress))
165+
return cniTypes.NewError(cniTypes.ErrUnsupportedField, err.Error(), "failed to parse interface MAC address")
166+
}
167+
168+
cniResult.Interfaces = append(cniResult.Interfaces, &types100.Interface{
169+
Mac: infMac.String(),
170+
})
171+
seenInterfaces[podIPInfo.MacAddress] = true
161172
}
162-
cniResult.Interfaces[0] = interface_test
163173

164174
p.logger.Info("Created CNIResult:", zap.Any("result", cniResult))
165175

cns/restserver/util.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ func (service *HTTPRestService) saveNetworkContainerGoalState(req cns.CreateNetw
171171
hostVersion = "-1"
172172
}
173173

174-
hostVersion = req.Version
175-
176174
// Remove the auth token before saving the containerStatus to cns json file
177175
createNetworkContainerRequest := req
178176
createNetworkContainerRequest.AuthorizationToken = ""

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/avast/retry-go/v3 v3.1.1
1313
github.com/avast/retry-go/v4 v4.6.1
1414
github.com/billgraziano/dpapi v0.5.0
15-
github.com/containernetworking/cni v1.2.3
15+
github.com/containernetworking/cni v1.2.2
1616
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
1717
github.com/go-logr/zapr v1.3.0 // indirect
1818
github.com/golang/mock v1.6.0
@@ -25,7 +25,7 @@ require (
2525
github.com/microsoft/ApplicationInsights-Go v0.4.4
2626
github.com/nxadm/tail v1.4.11
2727
github.com/onsi/ginkgo v1.16.5
28-
github.com/onsi/gomega v1.36.0
28+
github.com/onsi/gomega v1.33.1
2929
github.com/patrickmn/go-cache v2.1.0+incompatible
3030
github.com/pkg/errors v0.9.1
3131
github.com/prometheus/client_golang v1.21.1
@@ -199,5 +199,3 @@ retract (
199199
v1.16.15 // typo in the version number.
200200
v1.15.22 // typo in the version number.
201201
)
202-
203-
replace github.com/Azure/azure-container-networking => ./azure-container-networking

go.sum

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,8 @@ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151X
8888
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
8989
github.com/containerd/typeurl/v2 v2.2.0 h1:6NBDbQzr7I5LHgp34xAXYF5DOTQDn05X58lsPEmzLso=
9090
github.com/containerd/typeurl/v2 v2.2.0/go.mod h1:8XOOxnyatxSWuG8OfsZXVnAF4iZfedjS/8UHSPJnX4g=
91-
github.com/containernetworking/cni v1.2.3 h1:hhOcjNVUQTnzdRJ6alC5XF+wd9mfGIUaj8FuJbEslXM=
92-
github.com/containernetworking/cni v1.2.3/go.mod h1:DuLgF+aPd3DzcTQTtp/Nvl1Kim23oFKdm2okJzBQA5M=
93-
github.com/containernetworking/plugins v1.6.2 h1:pqP8Mq923TLyef5g97XfJ/xpDeVek4yF8A4mzy9Tc4U=
94-
github.com/containernetworking/plugins v1.6.2/go.mod h1:SP5UG3jDO9LtmfbBJdP+nl3A1atOtbj2MBOYsnaxy64=
91+
github.com/containernetworking/cni v1.2.2 h1:9IbP6KJQQxVKo4hhnm8r50YcVKrJbJu3Dqw+Rbt1vYk=
92+
github.com/containernetworking/cni v1.2.2/go.mod h1:DuLgF+aPd3DzcTQTtp/Nvl1Kim23oFKdm2okJzBQA5M=
9593
github.com/coreos/go-iptables v0.8.0 h1:MPc2P89IhuVpLI7ETL/2tx3XZ61VeICZjYqDEgNsPRc=
9694
github.com/coreos/go-iptables v0.8.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
9795
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
@@ -242,10 +240,7 @@ github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKu
242240
github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw=
243241
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
244242
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
245-
<<<<<<< HEAD
246243
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
247-
=======
248-
>>>>>>> 8d4b07a15 (deps: bump github.com/prometheus/client_golang from 1.20.5 to 1.21.0 (#3435))
249244
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
250245
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
251246
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
@@ -300,8 +295,8 @@ github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
300295
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
301296
github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
302297
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
303-
github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg=
304-
github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
298+
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
299+
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
305300
github.com/onsi/gomega v1.10.0 h1:Gwkk+PTu/nfOwNMtUB/mRUv0X7ewW5dO4AERT1ThVKo=
306301
github.com/onsi/gomega v1.10.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
307302
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b h1:FfH+VrHHk6Lxt9HdVS0PXzSXFyS2NbZKXv33FYPol0A=

0 commit comments

Comments
 (0)