diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-07-03 15:53:23 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-07-03 15:53:23 +0200 |
| commit | 5d17110366adb7fa1e69c5b350e28523b0fb85d4 (patch) | |
| tree | 60ba16b6df839d9feceb2148735a9a879f394419 | |
| parent | 38968509b59329f2d0743312fc8f9a4f98daa66c (diff) | |
| parent | 0359852bde5185fbbdf826ab6165d5c595f66914 (diff) | |
| download | mullvadvpn-5d17110366adb7fa1e69c5b350e28523b0fb85d4.tar.xz mullvadvpn-5d17110366adb7fa1e69c5b350e28523b0fb85d4.zip | |
Merge branch 'make-linux-firewall-send'
| -rw-r--r-- | talpid-core/src/firewall/linux/mod.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/talpid-core/src/firewall/linux/mod.rs b/talpid-core/src/firewall/linux/mod.rs index 25e38f99cc..67005516a3 100644 --- a/talpid-core/src/firewall/linux/mod.rs +++ b/talpid-core/src/firewall/linux/mod.rs @@ -74,7 +74,7 @@ enum End { /// The Linux implementation for the `Firewall` trait. pub struct Netfilter { dns_settings: DnsSettings, - table: Table, + table_name: CString, } impl Firewall for Netfilter { @@ -83,7 +83,7 @@ impl Firewall for Netfilter { fn new<P: AsRef<Path>>(_cache_dir: P) -> Result<Self> { Ok(Netfilter { dns_settings: DnsSettings::new()?, - table: Table::new(&*TABLE_NAME, ProtoFamily::Inet)?, + table_name: TABLE_NAME.clone(), }) } @@ -92,7 +92,8 @@ impl Firewall for Netfilter { self.dns_settings.set_dns(vec![tunnel.gateway.into()])?; } - let batch = PolicyBatch::new(&self.table)?.finalize(&policy)?; + let table = Table::new(&self.table_name, ProtoFamily::Inet)?; + let batch = PolicyBatch::new(&table)?.finalize(&policy)?; self.send_and_process(&batch) } @@ -101,12 +102,13 @@ impl Firewall for Netfilter { error!("Failed to reset DNS settings: {}", error.display_chain()); } + let table = Table::new(&self.table_name, ProtoFamily::Inet)?; let batch = { let mut batch = Batch::new()?; // Our batch will add and remove the table even though the goal is just to remove it. // This because only removing it throws a strange error if the table does not exist. - batch.add(&self.table, nftnl::MsgType::Add)?; - batch.add(&self.table, nftnl::MsgType::Del)?; + batch.add(&table, nftnl::MsgType::Add)?; + batch.add(&table, nftnl::MsgType::Del)?; batch.finalize()? }; |
