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

Avoid failure to add interface when XFRM is not supported by the kernel #8710

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cni-plugin/pkg/dataplane/linux/dataplane_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/sirupsen/logrus"
"github.com/vishvananda/netlink"
"golang.org/x/sys/unix"

"github.com/projectcalico/calico/cni-plugin/pkg/types"
api "github.com/projectcalico/calico/libcalico-go/lib/apis/v3"
Expand Down Expand Up @@ -67,7 +68,7 @@ func (d *linuxDataplane) DoNetworking(

d.logger.Infof("Setting the host side veth name to %s", hostVethName)

hostNlHandle, err := netlink.NewHandle()
hostNlHandle, err := netlink.NewHandle(unix.NETLINK_ROUTE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do unix.NETLINK_ROUTE is only related to route property?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, not only routing.

From the netlink man page:

NETLINK_ROUTE
Receives routing and link updates and may be used to
modify the routing tables (both IPv4 and IPv6), IP
addresses, link parameters, neighbor setups, queueing
disciplines, traffic classes, and packet classifiers (see
rtnetlink(7)).

Copy link
Contributor

Choose a reason for hiding this comment

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

I got it! thanks for your details.

if err != nil {
return "", "", fmt.Errorf("failed to create host netlink handle: %v", err)
}
Expand Down