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

Using the netlink.NewLinkAttrs to bring default values from kernel #7358

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

radixo
Copy link
Contributor

@radixo radixo commented Feb 16, 2023

Description

This PR solves a miscommunication between calico-cni and kernel, where a misconfiguration of the structure netlink.LinkAttrs was sending to kernel the information of the queue discipline for the veth pairs generated by calico-cni to be of value 0.
The problem was caused by creating the structure without the function netlink.NewLinkAttrs which initializes the TxQLen to -1, for not sending this info to kernel and getting the kernel default value instead.
For good practices I changed in everywhere the code.

Related issues/PRs

Todos

  • Tests
  • Release note

Release Note

Ensure that veths are created with the proper default values from the kernel.

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.

@radixo radixo requested a review from a team as a code owner February 16, 2023 10:15
@marvin-tigera marvin-tigera added this to the Calico v3.26.0 milestone Feb 16, 2023
@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 Feb 16, 2023
@mgleung mgleung added the docs-not-required Docs not required for this change label Feb 16, 2023
@marvin-tigera marvin-tigera removed the docs-pr-required Change is not yet documented label Feb 16, 2023
@@ -76,14 +76,14 @@ func (d *linuxDataplane) DoNetworking(
}

err = ns.WithNetNSPath(args.Netns, func(hostNS ns.NetNS) error {
la := netlink.NewLinkAttrs()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm worried that using the constructor masks the issue and that we may not realize what values we are intending to set here for TxQLen and NetNsID. Maybe we should add a comment here stating that this constructor should also be setting those values so that we will use the kernel defaults?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm idk, the library specifically says to use the constructor or set all the values properly. We would have to comment every usecase. I wish there was no accesses to the individual items and then there would be no such an issue but to use the constructor 🤷‍♂️ I think this is a great catch! Thanks @radixo !

@mgleung mgleung merged commit 364172b into projectcalico:master Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required Docs not required for this change 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

4 participants