DO NOT MERGE: Update OEM iptable hooks and ip fwd

This is a squash of two changes from partner repo:

    Clean up OEM iptables hooks

    Id: Ife7a1c08ca88beba2dede776d2e4dd6097dad05a

And

    Add hooks for OEM iptables rules and IP fwd

    - Useful for integrating peripherals that use IP for control and
    diagnostics.
    - Add hooks for specifying static iptables rules at startup.
    - Add system prop to keep IP forwarding enabled all the time.
    - Remove the ro.bootmode=bp-tools hacks.

    Id: Ic70d4c88179c530414505976193bf616037500a6

Bug: 5045218
Change-Id: I4229d3576426880b68ac448f9fbb67f2f8f304a0
diff --git a/TetherController.cpp b/TetherController.cpp
index 2059cce..5af59f0 100644
--- a/TetherController.cpp
+++ b/TetherController.cpp
@@ -53,12 +53,17 @@
 
 int TetherController::setIpFwdEnabled(bool enable) {
 
+    // Give OEMs ability to leave IP Fwd enabled all the time for test modes.
+    char allowIpFwd[PROPERTY_VALUE_MAX] = {0};
+    property_get("ro.allow.ip.fwd", allowIpFwd, "0");
+    if ((enable == false) && ('1' == allowIpFwd[0])) {
+        LOGW("Ignoring IP forward disable due to OEM setting");
+        return 0;
+    }
+
     LOGD("Setting IP forward enable = %d", enable);
 
-    // In BP tools mode, do not disable IP forwarding
-    char bootmode[PROPERTY_VALUE_MAX] = {0};
-    property_get("ro.bootmode", bootmode, "unknown");
-    if ((enable == false) && (0 == strcmp("bp-tools", bootmode))) {
+    if (enable == false) {
         return 0;
     }