Skip to content

Commit d924f05

Browse files
committed
build: update github.com/vishvananda/netlink to 1.3.0
This includes a breaking change: vishvananda/netlink@acdc658 route.Dst is now a zero IPNet instead of nil Signed-off-by: Etienne Champetier <[email protected]>
1 parent 5188dc8 commit d924f05

67 files changed

Lines changed: 5473 additions & 762 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/containernetworking/plugins
22

3-
go 1.20
3+
go 1.21
44

55
require (
66
github.com/Microsoft/hcsshim v0.12.4
@@ -19,7 +19,7 @@ require (
1919
github.com/onsi/gomega v1.33.1
2020
github.com/opencontainers/selinux v1.11.0
2121
github.com/safchain/ethtool v0.4.1
22-
github.com/vishvananda/netlink v1.2.1-beta.2
22+
github.com/vishvananda/netlink v1.3.0
2323
golang.org/x/sys v0.21.0
2424
)
2525

go.sum

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
121121
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
122122
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
123123
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
124-
github.com/vishvananda/netlink v1.2.1-beta.2 h1:Llsql0lnQEbHj0I1OuKyp8otXp0r3q0mPkuhwHfStVs=
125-
github.com/vishvananda/netlink v1.2.1-beta.2/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
126-
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
124+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
125+
github.com/vishvananda/netlink v1.3.0 h1:X7l42GfcV4S6E4vHTsw48qbrV+9PVojNfIhZcwQdrZk=
126+
github.com/vishvananda/netlink v1.3.0/go.mod h1:i6NetklAujEcC6fK0JPjT8qSwWyO0HLn4UKG+hGqeJs=
127127
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
128128
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
129129
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -167,16 +167,16 @@ golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7w
167167
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
168168
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
169169
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
170-
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
171170
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
172-
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
173171
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
174172
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
175173
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
176174
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
177175
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
178176
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
179177
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
178+
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
179+
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
180180
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
181181
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
182182
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

pkg/ip/route_linux.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,16 @@ func AddDefaultRoute(gw net.IP, dev netlink.Link) error {
5050
}
5151
return AddRoute(defNet, gw, dev)
5252
}
53+
54+
// IsIPNetZero check if the IPNet is "0.0.0.0/0" or "::/0"
55+
// This is needed as go-netlink replaces nil Dst with a '0' IPNet since
56+
// https://github.com/vishvananda/netlink/commit/acdc658b8613655ddb69f978e9fb4cf413e2b830
57+
func IsIPNetZero(ipnet *net.IPNet) bool {
58+
if ipnet == nil {
59+
return true
60+
}
61+
if ones, _ := ipnet.Mask.Size(); ones != 0 {
62+
return false
63+
}
64+
return ipnet.IP.Equal(net.IPv4zero) || ipnet.IP.Equal(net.IPv6zero)
65+
}

pkg/utils/conntrack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func DeleteConntrackEntriesForDstIP(dstIP string, protocol uint8) error {
5151
filter.AddIP(netlink.ConntrackOrigDstIP, ip)
5252
filter.AddProtocol(protocol)
5353

54-
_, err := netlink.ConntrackDeleteFilter(netlink.ConntrackTable, family, filter)
54+
_, err := netlink.ConntrackDeleteFilters(netlink.ConntrackTable, family, filter)
5555
if err != nil {
5656
return fmt.Errorf("error deleting connection tracking state for protocol: %d IP: %s, error: %v", protocol, ip, err)
5757
}
@@ -65,7 +65,7 @@ func DeleteConntrackEntriesForDstPort(port uint16, protocol uint8, family netlin
6565
filter.AddProtocol(protocol)
6666
filter.AddPort(netlink.ConntrackOrigDstPort, port)
6767

68-
_, err := netlink.ConntrackDeleteFilter(netlink.ConntrackTable, family, filter)
68+
_, err := netlink.ConntrackDeleteFilters(netlink.ConntrackTable, family, filter)
6969
if err != nil {
7070
return fmt.Errorf("error deleting connection tracking state for protocol: %d Port: %d, error: %v", protocol, port, err)
7171
}

plugins/main/bridge/bridge_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ func (tester *testerV10x) cmdAddTest(tc testCase, dataDir string) (types.Result,
724724
continue
725725
}
726726
for _, route := range routes {
727-
*found = (route.Dst == nil && route.Src == nil && route.Gw.Equal(gwIP))
727+
*found = (ip.IsIPNetZero(route.Dst) && route.Src == nil && route.Gw.Equal(gwIP))
728728
if *found {
729729
break
730730
}
@@ -809,7 +809,7 @@ func (tester *testerV10x) cmdCheckTest(tc testCase, conf *Net, _ string) {
809809
continue
810810
}
811811
for _, route := range routes {
812-
*found = (route.Dst == nil && route.Src == nil && route.Gw.Equal(gwIP))
812+
*found = (ip.IsIPNetZero(route.Dst) && route.Src == nil && route.Gw.Equal(gwIP))
813813
if *found {
814814
break
815815
}
@@ -1059,7 +1059,7 @@ func (tester *testerV04x) cmdAddTest(tc testCase, dataDir string) (types.Result,
10591059
continue
10601060
}
10611061
for _, route := range routes {
1062-
*found = (route.Dst == nil && route.Src == nil && route.Gw.Equal(gwIP))
1062+
*found = (ip.IsIPNetZero(route.Dst) && route.Src == nil && route.Gw.Equal(gwIP))
10631063
if *found {
10641064
break
10651065
}
@@ -1143,7 +1143,7 @@ func (tester *testerV04x) cmdCheckTest(tc testCase, conf *Net, _ string) {
11431143
continue
11441144
}
11451145
for _, route := range routes {
1146-
*found = (route.Dst == nil && route.Src == nil && route.Gw.Equal(gwIP))
1146+
*found = (ip.IsIPNetZero(route.Dst) && route.Src == nil && route.Gw.Equal(gwIP))
11471147
if *found {
11481148
break
11491149
}
@@ -1391,7 +1391,7 @@ func (tester *testerV03x) cmdAddTest(tc testCase, dataDir string) (types.Result,
13911391
continue
13921392
}
13931393
for _, route := range routes {
1394-
*found = (route.Dst == nil && route.Src == nil && route.Gw.Equal(gwIP))
1394+
*found = (ip.IsIPNetZero(route.Dst) && route.Src == nil && route.Gw.Equal(gwIP))
13951395
if *found {
13961396
break
13971397
}
@@ -1612,7 +1612,7 @@ func (tester *testerV01xOr02x) cmdAddTest(tc testCase, dataDir string) (types.Re
16121612
continue
16131613
}
16141614
for _, route := range routes {
1615-
*found = (route.Dst == nil && route.Src == nil && route.Gw.Equal(gwIP))
1615+
*found = (ip.IsIPNetZero(route.Dst) && route.Src == nil && route.Gw.Equal(gwIP))
16161616
if *found {
16171617
break
16181618
}

plugins/main/ipvlan/ipvlan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func getDefaultRouteInterfaceName() (string, error) {
195195
}
196196

197197
for _, v := range routeToDstIP {
198-
if v.Dst == nil {
198+
if ip.IsIPNetZero(v.Dst) {
199199
l, err := netlink.LinkByIndex(v.LinkIndex)
200200
if err != nil {
201201
return "", err

plugins/main/macvlan/macvlan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func getDefaultRouteInterfaceName() (string, error) {
6767
}
6868

6969
for _, v := range routeToDstIP {
70-
if v.Dst == nil {
70+
if ip.IsIPNetZero(v.Dst) {
7171
l, err := netlink.LinkByIndex(v.LinkIndex)
7272
if err != nil {
7373
return "", err

plugins/meta/sbr/sbr_linux_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ var _ = Describe("sbr test", func() {
291291
expNet1.Routes = append(expNet1.Routes,
292292
netlink.Route{
293293
Gw: net.IPv4(192, 168, 1, 1),
294+
Dst: &net.IPNet{IP: net.IPv4zero, Mask: net.IPMask(net.IPv4zero)},
294295
Table: 100,
295296
LinkIndex: expNet1.Routes[0].LinkIndex,
296297
})
@@ -491,13 +492,15 @@ var _ = Describe("sbr test", func() {
491492
}
492493
expNet1.Routes = append(expNet1.Routes,
493494
netlink.Route{
495+
Dst: &net.IPNet{IP: net.IPv4zero, Mask: net.IPMask(net.IPv4zero)},
494496
Gw: net.IPv4(192, 168, 1, 1),
495497
Table: 100,
496498
LinkIndex: expNet1.Routes[0].LinkIndex,
497499
})
498500

499501
expNet1.Routes = append(expNet1.Routes,
500502
netlink.Route{
503+
Dst: &net.IPNet{IP: net.IPv4zero, Mask: net.IPMask(net.IPv4zero)},
501504
Gw: net.IPv4(192, 168, 101, 1),
502505
Table: 101,
503506
LinkIndex: expNet1.Routes[0].LinkIndex,

vendor/github.com/vishvananda/netlink/.gitignore

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/vishvananda/netlink/addr_linux.go

Lines changed: 28 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)