mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-08 21:08:04 -05:00
fix(harness): iptable rule and bench config variable (#925)
* fix(harness): iptable rule and bench config variable * rustfmt
This commit is contained in:
@@ -6,29 +6,29 @@ bandwidth = 1000
|
||||
|
||||
[[bench]]
|
||||
group = "latency"
|
||||
latency = 10
|
||||
protocol_latency = 10
|
||||
|
||||
[[bench]]
|
||||
group = "latency"
|
||||
latency = 25
|
||||
protocol_latency = 25
|
||||
|
||||
[[bench]]
|
||||
group = "latency"
|
||||
latency = 50
|
||||
protocol_latency = 50
|
||||
|
||||
[[bench]]
|
||||
group = "latency"
|
||||
latency = 100
|
||||
protocol_latency = 100
|
||||
|
||||
[[bench]]
|
||||
group = "latency"
|
||||
latency = 200
|
||||
protocol_latency = 200
|
||||
|
||||
#### Bandwidth ####
|
||||
|
||||
[[group]]
|
||||
name = "bandwidth"
|
||||
latency = 25
|
||||
protocol_latency = 25
|
||||
|
||||
[[bench]]
|
||||
group = "bandwidth"
|
||||
|
||||
@@ -68,7 +68,8 @@ impl BenchItems {
|
||||
pub struct BenchGroupItem {
|
||||
pub name: String,
|
||||
pub samples: Option<usize>,
|
||||
pub latency: Option<usize>,
|
||||
pub protocol_latency: Option<usize>,
|
||||
pub app_latency: Option<usize>,
|
||||
pub bandwidth: Option<usize>,
|
||||
#[serde(rename = "upload-size")]
|
||||
pub upload_size: Option<usize>,
|
||||
@@ -105,7 +106,11 @@ impl BenchItem {
|
||||
}
|
||||
|
||||
if self.protocol_latency.is_none() {
|
||||
self.protocol_latency = group.latency;
|
||||
self.protocol_latency = group.protocol_latency;
|
||||
}
|
||||
|
||||
if self.app_latency.is_none() {
|
||||
self.app_latency = group.app_latency;
|
||||
}
|
||||
|
||||
if self.bandwidth.is_none() {
|
||||
|
||||
@@ -124,6 +124,12 @@ impl Network {
|
||||
self.veth_app_1.0.up()?;
|
||||
self.veth_app_1.1.up()?;
|
||||
|
||||
// Enable forwarding on the bridge interface
|
||||
duct::cmd!(
|
||||
"sudo", "iptables", "-I", "FORWARD", "-i", BRIDGE, "-o", BRIDGE, "-j", "ACCEPT"
|
||||
)
|
||||
.run()?;
|
||||
|
||||
duct::cmd!(
|
||||
"sudo",
|
||||
"ip",
|
||||
@@ -239,6 +245,14 @@ impl Network {
|
||||
self.veth_app_0.delete()?;
|
||||
self.veth_app_1.delete()?;
|
||||
self.veth_app.delete()?;
|
||||
|
||||
// Clean iptables forwarding rule
|
||||
duct::cmd!(
|
||||
"sudo", "iptables", "-D", "FORWARD", "-i", BRIDGE, "-o", BRIDGE, "-j", "ACCEPT"
|
||||
)
|
||||
.unchecked()
|
||||
.run()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user