Skip to content

Commit

Permalink
Explicitly specifiying ipset revision seems to fix some ipset creatio…
Browse files Browse the repository at this point in the history
…n/insertion corner cases (istio#53862)

* Explicitly specifiying ipset revision seems to fix some corner cases

Signed-off-by: Benjamin Leggett <benjamin.leggett@solo.io>

* Relnote

Signed-off-by: Benjamin Leggett <benjamin.leggett@solo.io>

* Use Revision=2, it works just as well and based on sketchy code comments in the userspace binary is maybe ~more correct

Signed-off-by: Benjamin Leggett <benjamin.leggett@solo.io>

---------

Signed-off-by: Benjamin Leggett <benjamin.leggett@solo.io>
  • Loading branch information
bleggett authored Nov 18, 2024
1 parent c3253de commit 5237ccc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cni/pkg/ipset/nldeps_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ func (m *realDeps) ipsetIPHashCreate(name string, v6 bool) error {
} else {
family = unix.AF_INET
}
err := netlink.IpsetCreate(name, "hash:ip", netlink.IpsetCreateOptions{Comments: true, Replace: true, Family: family})

// Note: `vishvananda/netlink` seems to have a bug where it defaults to revision=1 for `hash:ip,port` but defaults to revision=0 for `hash:ip`
// This causes breakages in some cases with Docker-based nodes: https://github.com/istio/istio/issues/53512
// Setting `Revision=2` here seems to work correctly in all cases found thus far.
// Source: https://github.com/Olipro/ipset/blob/9f145b49100104d6570fe5c31a5236816ebb4f8f/kernel/net/netfilter/ipset/ip_set_hash_ip.c#L28
err := netlink.IpsetCreate(name, "hash:ip", netlink.IpsetCreateOptions{Comments: true, Replace: true, Revision: 2, Family: family})
// Note there appears to be a bug in vishvananda/netlink here:
// https://github.com/vishvananda/netlink/issues/992
//
Expand Down
8 changes: 8 additions & 0 deletions releasenotes/notes/53862.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: release-notes/v2
kind: bug-fix
area: installation
issue:
- https://github.com/istio/istio/issues/53512
releaseNotes:
- |
**Fixed** an issue where ipset entry creation would fail on certain kinds of Docker-based kubernetes nodes

0 comments on commit 5237ccc

Please sign in to comment.