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

[v1.15] Multicast Datapath Backport #31668

Merged

Conversation

ldelossa
Copy link
Contributor

@ldelossa ldelossa requested review from a team as code owners March 28, 2024 23:57
@ldelossa ldelossa requested a review from glibsm March 28, 2024 23:57
@maintainer-s-little-helper maintainer-s-little-helper bot added backport/1.15 This PR represents a backport for Cilium 1.15.x of a PR that was merged to main. kind/backports This PR provides functionality previously merged into master. labels Mar 28, 2024
Copy link
Contributor

@michi-covalent michi-covalent left a comment

Choose a reason for hiding this comment

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

changes in api/v1 lgtm

[ upstream commit b7822a3 ]

This commit adds the eBPF map used to implement the synthetic multicast
feature.

A `BPF_MAP_TYPE_HASH_OF_MAPS`, which employees a `BPF_MAP_TYPE_HASH`
inner map, is added to the datapath.

The outer eBPF map is keyed by IPv4 multicast group addresses in big
endian format and the values are `BPF_MAP_TYPE_HASH` maps.

The inner hash map associates IPv4 source addresses with their
subscriber multicast metadata.

Each key/value in the inner hash map is a subscriber of the owning
multicast group.

Signed-off-by: Louis DeLosSantos <louis.delos@isovalent.com>
[ upstream commit d7e580f ]

This commit introduces IGMPv3 detection and parsing.

When bpf_lxc recognizes IGMP messages egressing the Pod we attempt to
parse them.

The parsing logic is as follows:
1. Determine if traffic is IGMP
2. Determine the IGMP message type
3. If the type is not a membership report simply drop it (for now)
4. Parse each group record in the membership report
5. For any group records which indicate a join add a subscriber to the
   multicast subscriber map, if it exists.

Signed-off-by: Louis DeLosSantos <louis.delos@isovalent.com>
[ upstream commit 8c488dd ]

This commit adds parsing of IGMPv2 messages in a similar fashion as
IGMPv3 messages.

Signed-off-by: Louis DeLosSantos <louis.delos@isovalent.com>
[ upstream commit 2afcb61 ]

This commit implements replication and delivery of multicast packets.

This commit also enables the Cilium datapath to access both `bpf_clone_redirect`
and `bpf_map_for_each_elem` helpers.

The datapath flow is illustrated below:

┌──────────────────────────────────────────┐
│                                          │
│  Sender                                  │
│  ┌──────┐     ┌─────────┐                │
│  │ pod  ├─────► bpf_lxc │                │
│  └──────┘     └────┬────┘                │
│  Local Receivers   │  eBPF Replication   │
│  ┌──────┐ ┌──────┐ │  and Redirection    │
│  │ pod  ◄─┤ veth ◄─┤(cil_from_container) │
│  └──────┘ └──────┘ │ ┌───────┐           │
│                    ├─► vxlan │           │
│  ┌──────┐ ┌──────┐ │ └───┬───┘           │
│  │ pod  ◄─┤ veth ◄─┘     │               │
│  └──────┘ └──────┘  ┌────┘               │
│                     │                    │
└─────────────────────┼────────────────────┘
                      │
┌─────────────────────┼────────────────────┐
│                     │                    │
│                 ┌───▼───┐                │
│                 │ vxlan │                │
│                 └───┬───┘                │
│   Remote Receivers  │  eBPF Replication  │
│   ┌──────┐ ┌──────┐ │  and Redirection   │
│   │ pod  ◄─┤ veth ◄─┤  (from_overlay)    │
│   └──────┘ └──────┘ │                    │
│                     │                    │
│   ┌──────┐ ┌──────┐ │                    │
│   │ pod  ◄─┤ veth ◄─┘                    │
│   └──────┘ └──────┘                      │
│                                          │
└──────────────────────────────────────────┘

A multicast sender sends a multicast packet.

The sender's bpf_lxc program does a lookup in the multicast group map to
discover who has subscribed to the group.

The program then clones and redirects the packets to the subscriber's
ingress device on the host namespace.

If the subscriber is remote the packet is cloned and redirected to a
vxlan device for encapsulation.

Once the host stack forwards the vxlan encap'd packet to the receiving
vxlan device on the remote host a similar "clone and redirect" process
is performed once the vxlan driver decaps the packet.

Signed-off-by: Louis DeLosSantos <louis.delos@isovalent.com>
@ldelossa ldelossa force-pushed the ldelossa/multicast-datapath-v1.15 branch from 3b7de5a to 7255b3b Compare March 29, 2024 00:15
Signed-off-by: Louis DeLosSantos <louis.delos@isovalent.com>
@ldelossa
Copy link
Contributor Author

/test-backport-1.15

Copy link
Contributor

@michi-covalent michi-covalent left a comment

Choose a reason for hiding this comment

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

rubber stamping from tophat

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Mar 29, 2024
@michi-covalent michi-covalent merged commit 7422942 into cilium:v1.15 Mar 29, 2024
59 checks passed
@ldelossa ldelossa deleted the ldelossa/multicast-datapath-v1.15 branch March 29, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.15 This PR represents a backport for Cilium 1.15.x of a PR that was merged to main. kind/backports This PR provides functionality previously merged into master. ready-to-merge This PR has passed all tests and received consensus from code owners to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants