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

Detach batcher and direct feature #996

Merged
merged 7 commits into from
Dec 17, 2024

Conversation

LukasPukenis
Copy link
Contributor

@LukasPukenis LukasPukenis commented Nov 29, 2024

Batching relies on Sessionkeeper(is baked into it) which is not present when direct feature is disabled or if SessionKeeper::start fails.

This breaks cases where batching is enabled but direct feature is not for VPN reestablishment for example(added testcases fail on main). This is a limitation of the decision to keep SessionKeeper instead of introducing a separate entity for batching.

The fix is to override the batching feature when either SessionKeeper or Direct are None which is done here.

However I did an extra step and moved SessionKeeper outside the Direct entities as I think it doesn't belong there anymore due to being repurposed for more stuff(vpn, proxy, stun keepalives when batching, derp keepalives in progress). This moving out provided very minimal changes, though the diff looks huge.

Please see individual commits for more details

☑️ Definition of Done checklist

  • Commit history is clean (requirements)
  • README.md is updated
  • Functionality is covered by unit or integration tests

@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 1fc2a69 to e11fb52 Compare November 29, 2024 19:12
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from e11fb52 to 8c1bfb0 Compare November 29, 2024 19:26
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 8c1bfb0 to 0a21893 Compare December 2, 2024 07:22
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 0a21893 to 1d716f8 Compare December 2, 2024 07:41
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 1d716f8 to 2706f0a Compare December 2, 2024 09:54
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 2706f0a to 77232d6 Compare December 3, 2024 12:23
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 77232d6 to 208e05a Compare December 3, 2024 12:53
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 208e05a to b64cc85 Compare December 4, 2024 09:21
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from b64cc85 to 3d172c1 Compare December 4, 2024 09:28
@LukasPukenis LukasPukenis marked this pull request as ready for review December 4, 2024 10:42
@LukasPukenis LukasPukenis requested a review from a team as a code owner December 4, 2024 10:42
Copy link
Contributor

@gytsto gytsto left a comment

Choose a reason for hiding this comment

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

+0.5

src/device.rs Show resolved Hide resolved
Copy link
Contributor

@dfetti dfetti left a comment

Choose a reason for hiding this comment

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

+1.0

Copy link
Collaborator

@jjanowsk jjanowsk left a comment

Choose a reason for hiding this comment

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

Looks good in general. Very nice commit structure. But I don't like this approach to testing. It does not scale. It's ok in UTs, we can leave it there, but I would really rework the nat-lab part

nat-lab/tests/test_derp_connect.py Outdated Show resolved Hide resolved
src/device.rs Outdated Show resolved Hide resolved
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 3d172c1 to f62848b Compare December 12, 2024 13:11
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from f62848b to 10ae6c7 Compare December 12, 2024 16:14
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 10ae6c7 to a339eb2 Compare December 12, 2024 16:15
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from a339eb2 to 9228b5b Compare December 12, 2024 16:20
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 9228b5b to ed95223 Compare December 12, 2024 16:23
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from ed95223 to 03de9c2 Compare December 12, 2024 16:25
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 03de9c2 to e2ecc6b Compare December 16, 2024 07:31
nat-lab/tests/test_batching.py Outdated Show resolved Hide resolved
nat-lab/tests/test_batching.py Outdated Show resolved Hide resolved
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from e2ecc6b to b0e5359 Compare December 16, 2024 11:02
Batcher feature works by employing SessionKeeper
however since it's under a direct feature flag it means
that without enabling it as well, there's a failure.

This commit introduces a testcase that highlights that and
at the moment fails to pass.

Signed-off-by: Lukas Pukenis <[email protected]>
SessionKeeper is solely used for Direct connections
and thus only enabled when Direct feature is enabled.

However since it is very minimal, it makes sense
to augment it for use in batching more things.

This commit moves out SessionKeeper out from Direct
struct to the parent structure and is always present
from now on.

Signed-off-by: Lukas Pukenis <[email protected]>
SessionKeeper log refactored to be easier to
follow. Also introduces calls to SessionKeeper
if batching is enabled when upgrading from
Proxying to Direct and vice-versa. Current solution
because the key is the same skips that and misaligns
the keepalives which is an easy win.

A bunch of testcases are augmented with batching parameter

Signed-off-by: Lukas Pukenis <[email protected]>
Signed-off-by: Lukas Pukenis <[email protected]>
SessionKeeper might fail as indicated by
a failing test on MacOS without this commit.

When failing the previous behaviour was to set
direct entities to None and disable the functionality.

This commit reintroduces behaviour and also toggles batching
feature off since keepalives will rely on it.

Signed-off-by: Lukas Pukenis <[email protected]>
Proxying persistent keepalives are being done
by batcher when batching is used. Batcher uses
ICMP echo requests(pings) which is a different
mechanism from wireguard backend's keepalives.

To ensure those are being emitted the testcase uses
link detection and stops the peer. Given that there's
no other generated traffic it should trigger link detection
pretty soon and prove that batcher works correctly at least
to some degree.

Signed-off-by: Lukas Pukenis <[email protected]>
@LukasPukenis LukasPukenis force-pushed the LLT-5795_detach_session_keeper_and_direct_feature branch from 16efa59 to aee6ac6 Compare December 17, 2024 12:40
@LukasPukenis LukasPukenis merged commit 5384fb6 into main Dec 17, 2024
64 checks passed
@LukasPukenis LukasPukenis deleted the LLT-5795_detach_session_keeper_and_direct_feature branch December 17, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants