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

Bpf iface auto detection #8803

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

sridhartigera
Copy link
Member

@sridhartigera sridhartigera commented May 9, 2024

Description

This PR adds the following

  1. bond* added to the default value of dataIfacePattern Regex.
  2. Handle dynamic addition of interfaces to the bond.
  3. IFstate map changes to add more info about the type of each interface.

This PR does not handle attaching xdp programs to the bond slaves. Will be done subsequently.

Related issues/PRs

Todos

  • Tests
  • Documentation
  • Release note

Release Note

eBPF now handles bond interfaces.

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

@marvin-tigera marvin-tigera added this to the Calico v3.29.0 milestone May 9, 2024
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels May 9, 2024
@sridhartigera sridhartigera marked this pull request as ready for review May 14, 2024 01:08
@sridhartigera sridhartigera requested a review from a team as a code owner May 14, 2024 01:08
@sridhartigera sridhartigera changed the title Bpf iface detect Bpf iface auto detection May 14, 2024
Copy link
Contributor

@tomastigera tomastigera left a comment

Choose a reason for hiding this comment

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

As discussed offline, it would be good/possible not to introduce the new option, deprecate the l3 regexp and just see of ia device is l3 or l2 and or slave/master in a bond. That would let us exclude device using the pattern that we do not care and we woul dnot need to include bondX inthe patter to include bonds.

@@ -204,6 +204,7 @@ type Config struct {
BPFForceTrackPacketsFromIfaces []string `config:"iface-filter-slice;docker+"`
BPFDisableGROForIfaces *regexp.Regexp `config:"regexp;"`
BPFExcludeCIDRsFromNAT []string `config:"cidr-list;;"`
BPFInterfaceAutoDetection string `config:"oneof(TCP,Enabled,Disabled);Enabled;non-zero"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
BPFInterfaceAutoDetection string `config:"oneof(TCP,Enabled,Disabled);Enabled;non-zero"`
BPFInterfaceAutoDetection string `config:"oneof(Enabled,Disabled);Enabled;non-zero"`

Comment on lines 133 to 134
tc.Felixes[0].Exec("ip", "link", "add", "dummy0", "type", "dummy")
tc.Felixes[0].Exec("ip", "link", "add", "dummy1", "type", "dummy")
Copy link
Contributor

Choose a reason for hiding this comment

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

what if you named these devices eth3 and eth4 or somethign else that could interfere with the regexp?

Comment on lines 4067 to 4068
// Check if the interface is bond. If so, update the interface type for
// slaves, master.
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this comment relates to?


func (m *bpfEndpointManager) autoDetectInterfaceType(intf *net.Interface) IfaceType {
name := intf.Name
if name == "tunl0" {
Copy link
Contributor

Choose a reason for hiding this comment

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

what if ipip tunnel has a different name?

}

func isBondIface(name string) bool {
bonding := fmt.Sprintf("/sys/class/net/%s/bonding", name)
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be queried via netlink?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-pr-required Change is not yet documented release-note-required Change has user-facing impact (no matter how small)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants