Skip to content

Conversation

@stalowyjez
Copy link
Contributor

@stalowyjez stalowyjez commented Nov 6, 2025

Problem

Libtelio should use dynamically loaded libfirewall.so library

Solution

Add loader, load firewall library and use it instead of the implementation inside telio-firewall, which this PR removes.

☑️ Definition of Done checklist

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

@stalowyjez stalowyjez requested a review from a team as a code owner November 6, 2025 16:17
@stalowyjez stalowyjez marked this pull request as draft November 6, 2025 16:18
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from 73ad664 to a1dd30e Compare November 6, 2025 16:35
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from e84422e to 3449633 Compare December 8, 2025 15:52
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from 3449633 to e97d8d9 Compare December 8, 2025 16:02
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from a9c4f30 to 9e04ce8 Compare December 9, 2025 11:32
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from 2e519e4 to ea4dbac Compare December 9, 2025 15:52
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from ea4dbac to 61830c1 Compare December 11, 2025 13:00
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from de8f7b6 to dc263c8 Compare December 11, 2025 20:38
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from dc263c8 to 76c0f19 Compare December 11, 2025 21:57
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from 76c0f19 to 058fa4f Compare December 12, 2025 14:48
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from 058fa4f to ddeb5a8 Compare December 14, 2025 22:34
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from ddeb5a8 to f21965b Compare December 15, 2025 09:41
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from 58e207b to f542f59 Compare December 17, 2025 00:06
@stalowyjez stalowyjez force-pushed the LLT-6647-use_libfirewall branch from f542f59 to 9dee7a3 Compare December 17, 2025 09:09
@stalowyjez stalowyjez marked this pull request as ready for review December 17, 2025 09:27
@stalowyjez stalowyjez changed the base branch from main to LLT-6812-move_libfirewall_dependent_tests_to_gitlab December 17, 2025 09:31
once_cell.workspace = true
nat-detect.workspace = true
time.workspace = true
libloading = "0.8.9"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make this a workspace dependency since it's used in two crates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which is the second crate that uses it?

@@ -1 +1 @@
TRIGGERED_REF=LLT-6812-add_jobs_for_integration_tests
TRIGGERED_REF=LLT-6647-add_fixes_for_libfirewall_loading
Copy link
Contributor

Choose a reason for hiding this comment

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

Gentle reminder to remember to update this

Comment on lines 212 to 227
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos",))]
let lib_name = "libfirewall.dylib";

#[cfg(target_os = "windows")]
let lib_name = "firewall.dll";

#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "windows"
)))]
let lib_name = "libfirewall.so";

// We want to use this path when these are our tests or libtelio tests
let libfirewall_path = PathBuf::from(lib_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice


/libtelio/nat-lab/bin/configure_route.sh primary

cp /libtelio/nat-lab/tests/uniffi/libfirewall.so /usr/lib/libfirewall.so
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this executed if I run natlab locally? Because if so this would fail when executing locally and I think personally I would rather have the tests that depend on libfirewall fail if this copy fails, rather than the container setup failing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, co should that be checked and maybe-copied in the beginning in the any firewall test? Do you have some particular solution on your mind? Should that be some additional option when creating connection, or just a function to run or sth else?

Comment on lines +37 to +39
f"{DIST_PATH}libfirewall.dylib",
f"{NATLAB_CWD}/libfirewall.dylib",
True,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, I would rather have this succeed (with a warning) if the file is not there than failing at this stage

}

#[cfg(feature = "enable_firewall")]
fn upsert_peer_whitelist<F: Firewall>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Were all of these basically no-ops when we were using telio-firewall?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if that's what you mean, but it seems that the only thing it was doing when StatefullFirewall was not used, it was just feeding the pet firewall (which wasn't doing any real work) with configs from time to time

stalowyjez and others added 8 commits December 22, 2025 23:00
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.

3 participants