summaryrefslogtreecommitdiffhomepage
path: root/talpid-core
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2021-03-16 12:18:36 +0100
committerDavid Lönnhager <david.l@mullvad.net>2021-03-16 12:50:24 +0100
commit66d737f9f284c603003b22bf487e07be2ae98d41 (patch)
tree933da4227d1eeead1a7d9c23395102900fe15b14 /talpid-core
parent01213da3bd6bca15bdefba27e827393d3591b365 (diff)
downloadmullvadvpn-66d737f9f284c603003b22bf487e07be2ae98d41.tar.xz
mullvadvpn-66d737f9f284c603003b22bf487e07be2ae98d41.zip
Add counters to prerouting rules
Diffstat (limited to 'talpid-core')
-rw-r--r--talpid-core/src/firewall/linux.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/talpid-core/src/firewall/linux.rs b/talpid-core/src/firewall/linux.rs
index 8fc47040bb..95e7f5e46b 100644
--- a/talpid-core/src/firewall/linux.rs
+++ b/talpid-core/src/firewall/linux.rs
@@ -412,6 +412,9 @@ impl<'a> PolicyBatch<'a> {
prerouting_rule.add_expr(&nft_expr!(cmp == split_tunnel::MARK));
prerouting_rule.add_expr(&nft_expr!(immediate data crate::linux::TUNNEL_FW_MARK));
prerouting_rule.add_expr(&nft_expr!(meta mark set));
+ if *ADD_COUNTERS {
+ prerouting_rule.add_expr(&nft_expr!(counter));
+ }
self.batch.add(&prerouting_rule, nftnl::MsgType::Add);
}
@@ -635,6 +638,10 @@ impl<'a> PolicyBatch<'a> {
prerouting_rule.add_expr(&nft_expr!(immediate data crate::linux::TUNNEL_FW_MARK));
prerouting_rule.add_expr(&nft_expr!(meta mark set));
+ if *ADD_COUNTERS {
+ prerouting_rule.add_expr(&nft_expr!(counter));
+ }
+
self.batch.add(&prerouting_rule, nftnl::MsgType::Add);
let mut in_rule = Rule::new(&self.in_chain);