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

Fix source interface determination in encryption tests when rp_filter is set to strict #2113

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
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
11 changes: 8 additions & 3 deletions connectivity/tests/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ func getInterNodeIface(ctx context.Context, t *check.Test,
srcIP, dstIP := client.Address(ipFam), server.Address(ipFam)
ipRouteGetCmd := fmt.Sprintf("ip -o route get %s from %s", dstIP, srcIP)
if srcIP != clientHost.Address(ipFam) {
// The "iif lo" part is required when the source address is not one
// of the addresses of the host. If an interface is not specified
// The "iif cilium_host" part is required when the source address is not
// one of the addresses of the host. If an interface is not specified
// "ip route" returns "RTNETLINK answers: Network is unreachable" in
// case the "from" address is not assigned to any local interface.
ipRouteGetCmd = fmt.Sprintf("%s iif lo", ipRouteGetCmd)
// Any existing interface name works, as long as the corresponding
// rp_filter value is different from 1, i.e., strict (otherwise it
// returns "RTNETLINK answers: Invalid cross-device link"). For this
// reason, let's use one of the interfaces managed by Cilium, as we
// explicitly set rp_filter=0 for them.
ipRouteGetCmd = fmt.Sprintf("%s iif cilium_host", ipRouteGetCmd)
}

if enc, ok := t.Context().Feature(features.EncryptionPod); wgEncap && ok && enc.Enabled && enc.Mode == "wireguard" {
Expand Down