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

libreswan: Present --dpddelay if --dpdaction is specified #2599

Merged
merged 4 commits into from
Aug 17, 2023

Conversation

ueno
Copy link
Contributor

@ueno ueno commented Jul 3, 2023

These couple of commits are based on the suggestion from @paulwouters some time ago. I'm marking this as RFC as I haven't tested it but just built with "make build".

@submariner-bot
Copy link
Contributor

🤖 Created branch: z_pr2599/ueno/wip/dpdaction
🚀 Full E2E won't run until the "ready-to-test" label is applied. I will add it automatically once the PR has 2 approvals, or you can add it manually.

@sridhargaddam
Copy link
Member

Thank you @ueno for the PR.

Copy link
Member

@skitt skitt left a comment

Choose a reason for hiding this comment

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

Thanks for this; both changes make sense. I only have one small readability request...

pkg/cable/libreswan/libreswan.go Outdated Show resolved Hide resolved
ueno added 2 commits July 3, 2023 20:51
When a connection is added through `ipsec whack`, --dpdaction=hold
needs --dpddelay to be specified; otherwise the next probes may be
scheduled too frequently.

Signed-off-by: Daiki Ueno <[email protected]>
Instead of specifying the absolute path of the "whack" command, it is
recommended to invoke it through the "ipsec" wrapper.

Signed-off-by: Daiki Ueno <[email protected]>
@@ -460,7 +463,8 @@ func (i *libreswan) serverConnectToEndpoint(connectionName string, endpointInfo
"--id", remoteEndpointIdentifier,
"--host", "%any",
"--client", rightSubnet,
"--dpdaction=hold")
"--dpdaction=hold",
"--dpddelay", strconv.Itoa(dpdDelay))
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for this PR @ueno , overall code LGTM.
I have short Q: do we need to set also dpdtimeout in case dpddelay is set?

According to https://libreswan.org/man/ipsec.conf.5.html :
`dpddelay

Set the delay (in time units, defaults to seconds) between Dead Peer Detection (IKEv1 RFC 3706) or IKEv2 Liveness keepalives that are sent for this connection (default 0 seconds). Set to enable checking. If dpddelay is set, dpdtimeout also needs to be set.`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to Paul, dpdtimeout is only for IKEv1 and ignored if IKEv2 is used, so if you only use IKEv2 it shouldn't be necessary.

Choose a reason for hiding this comment

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

correct. with ikev1 message ID is random, and you can send many messages to see if you get a response with the same msgid. For IKEv2, msgid is linear and has a window size. Libreswan uses windows size = 1, so you can only have one IKE message outstanding per IKE SA. So if you send a DPD probe (IKEv2 Informational exchange msg), then you cannot any other IKE message until you get a response. Therefor, not getting a response is fatal, and this is tied to the generic IKE message response timeouts and there is no seperate "DPD timeout"

Choose a reason for hiding this comment

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

I will fix the man page upstream.

@submariner-bot submariner-bot added the ready-to-test When a PR is ready for full E2E testing label Jul 4, 2023
@nyechiel nyechiel added the datapath Datapath related issues or enhancements label Jul 4, 2023
@nyechiel
Copy link
Member

nyechiel commented Jul 6, 2023

What's the plan for taking this out of draft? Do we need further testing?

Copy link

@paulwouters paulwouters left a comment

Choose a reason for hiding this comment

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

LGTM but see the comment on using /usr/sbin/ipsec vs ipsec

@@ -175,7 +176,7 @@ func retrieveActiveConnectionStats() (map[string]int, map[string]int, error) {
defer cancel()

// Retrieve active tunnels from the daemon
cmd := exec.CommandContext(ctx, "/usr/libexec/ipsec/whack", "--trafficstatus")
cmd := exec.CommandContext(ctx, "/usr/sbin/ipsec", "whack", "--trafficstatus")

Choose a reason for hiding this comment

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

this is marginally better, but the best is to use "ipsec" without a path, so it works as long as it is in the path (/sbin or /usr/sbin or /usr/local/sbin or whatever compile time options are used). Using "ipsec " is supported specifically to avoid any hardcoded paths. if exec.CommandContext uses regular PATH handling, this is best run without the hardcoded path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I can modify the PR to use exec.LookPath("ipsec"), maybe somewhere in init.

@@ -460,7 +463,8 @@ func (i *libreswan) serverConnectToEndpoint(connectionName string, endpointInfo
"--id", remoteEndpointIdentifier,
"--host", "%any",
"--client", rightSubnet,
"--dpdaction=hold")
"--dpdaction=hold",
"--dpddelay", strconv.Itoa(dpdDelay))

Choose a reason for hiding this comment

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

I will fix the man page upstream.

@stale
Copy link

stale bot commented Aug 12, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 12, 2023
@nyechiel
Copy link
Member

nyechiel commented Aug 13, 2023

@ueno we are approaching the end of the Submariner 0.16 dev cycle, and going to enter code freeze soon. Can you please take this out of draft? I am assuming this is something we want to merge. Thanks!

@ueno ueno marked this pull request as ready for review August 16, 2023 08:34
@sridhargaddam
Copy link
Member

All e2e deployments are failing while overriding the network-plugin-syncer component.
The following PR should fix the issue - submariner-io/shipyard#1340

@stale stale bot removed the wontfix This will not be worked on label Aug 16, 2023
@skitt skitt merged commit ce21cc5 into submariner-io:devel Aug 17, 2023
37 checks passed
@submariner-bot
Copy link
Contributor

🤖 Closed branches: [z_pr2599/ueno/wip/dpdaction]

@dfarrell07 dfarrell07 added backport This change requires a backport to eligible release branches release-note-needed Should be mentioned in the release notes labels Aug 29, 2023
sridhargaddam added a commit to sridhargaddam/submariner-website that referenced this pull request Sep 12, 2023
skitt pushed a commit to submariner-io/submariner-website that referenced this pull request Sep 12, 2023
dfarrell07 pushed a commit to dfarrell07/submariner-website that referenced this pull request Oct 18, 2023
dfarrell07 pushed a commit to dfarrell07/submariner-website that referenced this pull request Oct 18, 2023
dfarrell07 pushed a commit to dfarrell07/submariner-website that referenced this pull request Oct 19, 2023
tpantelis pushed a commit to submariner-io/submariner-website that referenced this pull request Oct 22, 2023
tpantelis pushed a commit to tpantelis/submariner-website that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport This change requires a backport to eligible release branches backport-handled datapath Datapath related issues or enhancements ready-to-test When a PR is ready for full E2E testing release-note-handled release-note-needed Should be mentioned in the release notes
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants