Properly report failure in runIptablesAlertCmd.
(cherry picked from commit 7647305c6b13d0e448b055c8af9c09b34af79f5c)
Bug: 37641280
Test: netd_{unit,integration}_test pass
Change-Id: Ic2b692efae14c4c9ca19972bdd812edce1c39bb3
Merged-In: I36ef121ae0cfaa16032289fa6f8b0341e1a9ca20
diff --git a/server/BandwidthController.cpp b/server/BandwidthController.cpp
index 47fb823..30a048a 100644
--- a/server/BandwidthController.cpp
+++ b/server/BandwidthController.cpp
@@ -829,7 +829,6 @@
}
int BandwidthController::runIptablesAlertCmd(IptOp op, const char *alertName, int64_t bytes) {
- int res = 0;
const char *opFlag;
std::string alertQuotaCmd = "*filter\n";
@@ -849,8 +848,7 @@
StringAppendF(&alertQuotaCmd, ALERT_IPT_TEMPLATE, opFlag, "bw_OUTPUT", bytes, alertName);
StringAppendF(&alertQuotaCmd, "COMMIT\n");
- iptablesRestoreFunction(V4V6, alertQuotaCmd, nullptr);
- return res;
+ return iptablesRestoreFunction(V4V6, alertQuotaCmd, nullptr);
}
int BandwidthController::runIptablesAlertFwdCmd(IptOp op, const char *alertName, int64_t bytes) {