netd: Fix concurrency error for iptables command
When multiple user space processes run the iptables
commands conncurrently, the iptables exits immediately
since it fails to acquire a lock.
CRs-Fixed: 747905
Change-Id: I77cb377eac885139b0b08b13bb5b5388a52e2ce3
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index 140c0d3..37f6f90 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -437,7 +437,7 @@
char markString[UINT32_HEX_STRLEN];
snprintf(markString, sizeof(markString), "0x%x", fwmark.intValue);
- if (execIptables(V4V6, "-t", "mangle", add ? "-A" : "-D", "INPUT", "-i", interface, "-j",
+ if (execIptables(V4V6, "-w", "-t", "mangle", add ? "-A" : "-D", "INPUT", "-i", interface, "-j",
"MARK", "--set-mark", markString, NULL)) {
ALOGE("failed to change iptables rule that sets incoming packet mark");
return -EREMOTEIO;