Strict-related commands porting
Test: built, flashed, booted
system/netd/tests/runtests.sh passes
Change-Id: Ibff8b050915c65e44cd37bb835943b8582fc003a
diff --git a/server/StrictController.cpp b/server/StrictController.cpp
index 3304490..855bedb 100644
--- a/server/StrictController.cpp
+++ b/server/StrictController.cpp
@@ -47,7 +47,7 @@
StrictController::StrictController(void) {
}
-int StrictController::enableStrict(void) {
+int StrictController::setupIptablesHooks(void) {
char connmarkFlagAccept[16];
char connmarkFlagReject[16];
char connmarkFlagTestAccept[32];
@@ -61,7 +61,7 @@
ConnmarkFlags::STRICT_RESOLVED_REJECT,
ConnmarkFlags::STRICT_RESOLVED_REJECT);
- disableStrict();
+ resetChains();
int res = 0;
std::vector<std::string> v4, v6;
@@ -136,10 +136,10 @@
#undef CMD_V6
#undef CMD_V4V6
- return res;
+ return res ? -EREMOTEIO : 0;
}
-int StrictController::disableStrict(void) {
+int StrictController::resetChains(void) {
// Flush any existing rules
#define CLEAR_CHAIN(x) StringPrintf(":%s -", (x))
std::vector<std::string> commandList = {
@@ -152,7 +152,7 @@
"COMMIT\n"
};
const std::string commands = Join(commandList, '\n');
- return execIptablesRestore(V4V6, commands);
+ return (execIptablesRestore(V4V6, commands) == 0) ? 0 : -EREMOTEIO;
#undef CLEAR_CHAIN
}
@@ -194,5 +194,5 @@
}
commands.push_back("COMMIT\n");
- return execIptablesRestore(V4V6, Join(commands, "\n"));
+ return (execIptablesRestore(V4V6, Join(commands, "\n")) == 0) ? 0 : -EREMOTEIO;
}