Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routing: Fix route collisions in AWS ENI #14269

Merged

Conversation

christarazi
Copy link
Member

@christarazi christarazi commented Dec 4, 2020

See commit msgs.

This PR has been "forward-ported" from the following direct backport PR to the v1.7 branch: #14337.

Most commits have been forward-ported from the aforementioned PR, but a few commits are only meant for master (with intention to be backported to v1.9 & 1.8) because of code that didn't exist in v1.7 and because of the initial assumption that this issue impacts both ENI and Azure modes. In reality, only ENI mode has been impacted so far. While it is possible for the issue to occur on Azure, it is very unlikely and a separate PR will be made to address that (see #14705).

Fixes: #14336

@christarazi christarazi added area/azure Impacts Azure based IPAM. area/cni Impacts the Container Networking Interface between Cilium and the orchestrator. area/eni Impacts ENI based IPAM. kind/bug This is a bug in the Cilium logic. release-note/bug This PR fixes an issue in a previous release of Cilium. labels Dec 4, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. and removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Dec 4, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.10.0 Dec 4, 2020
@christarazi christarazi added the upgrade-impact This PR has potential upgrade or downgrade impact. label Dec 4, 2020
pkg/datapath/linux/routing/routing.go Outdated Show resolved Hide resolved
pkg/datapath/linux/routing/routing.go Outdated Show resolved Hide resolved
@christarazi christarazi force-pushed the pr/christarazi/eni-route-collision branch 3 times, most recently from 9cb50cc to 93e8218 Compare December 9, 2020 05:59
@stale
Copy link

stale bot commented Jan 10, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Jan 10, 2021
@christarazi christarazi removed the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Jan 10, 2021
@christarazi christarazi force-pushed the pr/christarazi/eni-route-collision branch from 93e8218 to 3dfb7f3 Compare January 24, 2021 23:41
@christarazi christarazi changed the title datapath/linux: Fix route collisions in AWS/Azure routing: Fix route collisions in AWS ENI Jan 24, 2021
@christarazi christarazi added needs-backport/1.8 and removed area/azure Impacts Azure based IPAM. upgrade-impact This PR has potential upgrade or downgrade impact. labels Jan 24, 2021
[ upstream commit 332a3fd; forward-ported from v1.7 tree ]

This commit fixes a potential route collision in AWS ENI IPAM modes,
where the ifindex could equal the main routing table ID (from 253-255)
[1], causing traffic to be subject to these routes incorrectly. This is
admittedly rare, but we've seen this from a user report. The impact is
that most traffic on the node is suddenly blackholed.

To fix this, we say that each device or interface (ENI) will have their
own dedicated routing table. The table ID will start with an offset of
10 because it is highly unlikely to collide with the main routing table
ID (from 253-255). We grab the number associated with the ENI device
(`Number`) and add the offset. For example, if we have an ENI device
"eni-0" which has a `Number` of 5, then the table ID will be 10 + 5 =
15.

Another important piece to note is that only the egress rule will reside
inside the per-device tables, whereas the ingress rule will stay in the
main routing table. This is because we want the main routing table to
hold the routes to the endpoint.

Moving forward, the ENI datapath will now create rules under a new
egress priority value (RulePriorityEgressv2), as long as the
egress-multi-home-ip-rule-compat flag is false. If it's true, then the
datapath will create rules under the original egress priority value
(RulePriorityEgress). This helps disambiguate when running with the
older or newer ENI datapath.

See cilium#14336.

[1]: See ip-route(8)

Reported-by: Vlad Ungureanu <vladu@palantir.com>
Suggested-by: Joe Stringer <joe@cilium.io>
Suggested-by: Thomas Graf <thomas@cilium.io>
Signed-off-by: Chris Tarazi <chris@isovalent.com>
@christarazi christarazi force-pushed the pr/christarazi/eni-route-collision branch from ac7b671 to 9efaa11 Compare January 25, 2021 19:17
@christarazi
Copy link
Member Author

test-me-please

Copy link
Member

@vadorovsky vadorovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the original PR and was happy with it, and I've now reviewed the commits that were not in the original PR. Those LGTM.

Let me know if you think I should pay closer attention to any of the remaining commits.

@joestringer joestringer merged commit 67dc983 into cilium:master Feb 3, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.8 in 1.8.7 Feb 3, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.9 in 1.9.4 Feb 3, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.9 to Backport done to v1.9 in 1.9.4 Feb 3, 2021
@christarazi christarazi deleted the pr/christarazi/eni-route-collision branch February 4, 2021 18:49
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.8 to Backport done to v1.8 in 1.8.7 Feb 11, 2021
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.8 to Backport done to v1.8 in 1.8.7 Feb 11, 2021
@christarazi christarazi mentioned this pull request Mar 2, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cni Impacts the Container Networking Interface between Cilium and the orchestrator. area/eni Impacts ENI based IPAM. kind/bug This is a bug in the Cilium logic. priority/high This is considered vital to an upcoming release. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
No open projects
1.8.7
Backport done to v1.8
1.9.4
Backport done to v1.9
Development

Successfully merging this pull request may close these issues.

Multi-homing route table bug in ENI mode
7 participants