Merge "netd: handle iwlan ip forwarding"
diff --git a/server/CommandListener.cpp b/server/CommandListener.cpp
index cbe5abb..a0810e8 100644
--- a/server/CommandListener.cpp
+++ b/server/CommandListener.cpp
@@ -101,6 +101,8 @@
 FirewallController *CommandListener::sFirewallCtrl = NULL;
 ClatdController *CommandListener::sClatdCtrl = NULL;
 QcRouteController *CommandListener::sQcRouteCtrl = NULL;
+bool CommandListener::IpFwdCmd::iWlanFwdEnable = false;
+bool CommandListener::IpFwdCmd::fwIpFwdEnable = false;
 
 /**
  * List of module chains to be created, along with explicit ordering. ORDERING
@@ -562,9 +564,21 @@
         free(tmp);
         return 0;
     } else if (!strcmp(argv[1], "enable")) {
+        if((argc > 2) && !strcmp(argv[2], "iwlan")) {
+            iWlanFwdEnable = true;
+        } else {
+            fwIpFwdEnable = true;
+        }
         rc = sTetherCtrl->setIpFwdEnabled(true);
     } else if (!strcmp(argv[1], "disable")) {
-        rc = sTetherCtrl->setIpFwdEnabled(false);
+        if((argc > 2) && !strcmp(argv[2], "iwlan")) {
+            iWlanFwdEnable = false;
+        } else {
+            fwIpFwdEnable = false;
+        }
+        if( !iWlanFwdEnable && !fwIpFwdEnable ) {
+            rc = sTetherCtrl->setIpFwdEnabled(false);
+        }
     } else {
         cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown ipfwd cmd", false);
         return 0;
diff --git a/server/CommandListener.h b/server/CommandListener.h
index c1f7867..76fe1b7 100644
--- a/server/CommandListener.h
+++ b/server/CommandListener.h
@@ -85,6 +85,9 @@
         IpFwdCmd();
         virtual ~IpFwdCmd() {}
         int runCommand(SocketClient *c, int argc, char ** argv);
+    private:
+        static bool iWlanFwdEnable;
+        static bool fwIpFwdEnable;
     };
 
     class TetherCmd : public NetdCommand {