netd: Active FTP Helper
Enable conntrack helper for active FTP connections when
tethering is started.
Bug:69265432
CRs-fixed:2136660
Test: as follows
- Boot device - Pass
- Start tethering - Pass
- Start active FTP on tethered host (USB) - Pass
- Download file over FTP - Pass
- make -j64 netd_unit_test
adb shell /data/nativetest64/netd_unit_test/netd_unit_test - Pass
Change-Id: I5c812afe9602e80ea1c42d0cafba40fe6019a995
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 6e805f5..06eaf94 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -630,6 +630,10 @@
}
std::vector<std::string> v4 = {
+ "*raw",
+ StringPrintf("%s %s -p tcp --dport 21 -i %s -j CT --helper ftp",
+ op, LOCAL_RAW_PREROUTING, intIface),
+ "COMMIT",
"*filter",
StringPrintf("%s %s -i %s -o %s -m state --state ESTABLISHED,RELATED -g %s",
op, LOCAL_FORWARD, extIface, intIface, LOCAL_TETHER_COUNTERS_CHAIN),
diff --git a/server/TetherControllerTest.cpp b/server/TetherControllerTest.cpp
index bcdb106..6e77bfe 100644
--- a/server/TetherControllerTest.cpp
+++ b/server/TetherControllerTest.cpp
@@ -127,6 +127,10 @@
"COMMIT\n", intIf);
std::vector<std::string> v4Cmds = {
+ "*raw",
+ StringPrintf("-A tetherctrl_raw_PREROUTING -p tcp --dport 21 -i %s -j CT --helper ftp",
+ intIf),
+ "COMMIT",
"*filter",
StringPrintf("-A tetherctrl_FORWARD -i %s -o %s -m state --state"
" ESTABLISHED,RELATED -g tetherctrl_counters", extIf, intIf),
@@ -195,6 +199,10 @@
"COMMIT\n", intIf);
std::vector<std::string> v4Cmds = {
+ "*raw",
+ StringPrintf("-D tetherctrl_raw_PREROUTING -p tcp --dport 21 -i %s -j CT --helper ftp",
+ intIf),
+ "COMMIT",
"*filter",
StringPrintf("-D tetherctrl_FORWARD -i %s -o %s -m state --state"
" ESTABLISHED,RELATED -g tetherctrl_counters", extIf, intIf),