Use iptables-restore in StrictController startup.
Bug: 21725996
Change-Id: I2c049a934189f3c87ee15f052abc07d35814f0c9
diff --git a/server/IptablesBaseTest.cpp b/server/IptablesBaseTest.cpp
index 3b96b81..5ce6667 100644
--- a/server/IptablesBaseTest.cpp
+++ b/server/IptablesBaseTest.cpp
@@ -64,8 +64,7 @@
}
int IptablesBaseTest::fakeExecIptablesRestore(IptablesTarget target, const std::string& commands) {
- EXPECT_EQ(V4V6, target);
- sRestoreCmds.push_back(commands);
+ sRestoreCmds.push_back({ target, commands });
return 0;
}
@@ -101,10 +100,21 @@
}
void IptablesBaseTest::expectIptablesRestoreCommands(const std::vector<std::string>& expectedCmds) {
+ ExpectedIptablesCommands expected;
+ for (auto cmd : expectedCmds) {
+ expected.push_back({ V4V6, cmd });
+ }
+ expectIptablesRestoreCommands(expected);
+}
+
+void IptablesBaseTest::expectIptablesRestoreCommands(const ExpectedIptablesCommands& expectedCmds) {
EXPECT_EQ(expectedCmds.size(), sRestoreCmds.size());
- EXPECT_EQ(expectedCmds, sRestoreCmds);
+ for (size_t i = 0; i < expectedCmds.size(); i++) {
+ EXPECT_EQ(expectedCmds[i], sRestoreCmds[i]) <<
+ "iptables-restore command " << i << " differs";
+ }
sRestoreCmds.clear();
}
std::vector<std::string> IptablesBaseTest::sCmds = {};
-std::vector<std::string> IptablesBaseTest::sRestoreCmds = {};
+IptablesBaseTest::ExpectedIptablesCommands IptablesBaseTest::sRestoreCmds = {};