Skip to content

Commit f6d1201

Browse files
committed
WIP
1 parent 1316ba1 commit f6d1201

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

test-utils/src/binaries/net-setup.rs

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,19 @@ fn main() -> Result<()> {
5757
"-s", &nat.cidr.to_string(),
5858
"-o", &nat.device,
5959
"-j", "MASQUERADE"
60-
])?
60+
])?;
61+
run_command(TRACE, ["iptables",
62+
"-I", "FORWARD",
63+
"-i", &nat.device,
64+
"-o", "bridge",
65+
"-j", "ACCEPT"
66+
])?;
67+
run_command(TRACE, ["iptables",
68+
"-I", "FORWARD",
69+
"-i", "bridge",
70+
"-o", &nat.device,
71+
"-j", "ACCEPT"
72+
])?;
6173
}
6274
}
6375
Command::Delete { config } => {
@@ -71,10 +83,28 @@ fn main() -> Result<()> {
7183
}
7284
dev.delete()?;
7385
}
74-
b.delete()?;
7586
if let Some(nat) = c.nat {
76-
run_command(TRACE, ["iptables", "-t", &nat.table, "-F"])?
87+
run_command(TRACE, ["iptables",
88+
"-t", &nat.table,
89+
"-D", "POSTROUTING",
90+
"-s", &nat.cidr.to_string(),
91+
"-o", &nat.device,
92+
"-j", "MASQUERADE"
93+
])?;
94+
run_command(TRACE, ["iptables",
95+
"-D", "FORWARD",
96+
"-i", &nat.device,
97+
"-o", "bridge",
98+
"-j", "ACCEPT"
99+
])?;
100+
run_command(TRACE, ["iptables",
101+
"-D", "FORWARD",
102+
"-i", "bridge",
103+
"-o", &nat.device,
104+
"-j", "ACCEPT"
105+
])?;
77106
}
107+
b.delete()?
78108
}
79109
}
80110
Ok(())

0 commit comments

Comments
 (0)