Move NatController startup to iptables-restore.
This makes NatController startup much faster. Before:
02-03 14:09:19.199 485 485 I Netd : Setting up NatController hooks: 223.4ms
After:
02-03 14:28:09.407 488 488 I Netd : Setting up NatController hooks: 13.8ms
Also, fail if MSS rewriting is not supported. It's much easier
to diagnose a failure than a performance problem.
Test: unit tests continue to pass
Test: bullhead builds, boots, wifi tethering works
Fix: 17629786
Bug: 34873832
Change-Id: I0ef498ecbbb82a2672c279056d189d026e13100a
diff --git a/server/NatController.h b/server/NatController.h
index 939f09d..5541a26 100644
--- a/server/NatController.h
+++ b/server/NatController.h
@@ -21,6 +21,8 @@
#include <list>
#include <string>
+#include "NetdConstants.h"
+
class NatController {
public:
NatController();
@@ -52,6 +54,7 @@
// For testing.
friend class NatControllerTest;
static int (*execFunction)(int, char **, int *, bool, bool);
+ static int (*iptablesRestoreFunction)(IptablesTarget, const std::string&);
};
#endif