NatController: Fix tethering-counting iptables rules handling
Fix duplicate tethering-pair detection. It was broken because the
underlying mechanism used quota2 which has a 15char limit and
the two combined interface names were longer than that.
Fix parsing or tether-counting rules when no interfaces are available
vs when parsing is broken.
Now the parser is not invoked if no tether-counting rules were created.
Bug: 10710027
Change-Id: I37899d113a37cd84255d439efa6e2ed3ce712ec0
diff --git a/NatController.h b/NatController.h
index 525ca02..52a1627 100644
--- a/NatController.h
+++ b/NatController.h
@@ -18,6 +18,7 @@
#define _NAT_CONTROLLER_H
#include <linux/in.h>
+#include <list>
#include "SecondaryTableController.h"
@@ -35,10 +36,15 @@
static const char* LOCAL_NAT_POSTROUTING;
static const char* LOCAL_TETHER_COUNTERS_CHAIN;
+ // List of strings of interface pairs.
+ std::list<std::string> ifacePairList;
+
private:
int natCount;
SecondaryTableController *secondaryTableCtrl;
+ bool checkTetherCountingRuleExist(const char *pair_name);
+
int setDefaults();
int runCmd(int argc, const char **argv);
bool checkInterface(const char *iface);