summaryrefslogtreecommitdiff
path: root/server/TetherControllerTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* rename OffloadUtils to TcUtilsPatrick Rohr2021-10-151-1/+1
| | | | | Test: m Change-Id: I40082f7d56f4d3ba088ebcab9417b4d2da0d6ba2
* TetherController - remove everything related to TetherOffloadStatsMaciej Żenczykowski2021-03-171-21/+0
| | | | | | | | These are no longer used due to move to tethering mainline module. Test: atest, TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I1f0f19724d343c12b496755073d7213f8f7f5099
* TetherControllerTest - remove needless fake bpf mapsMaciej Żenczykowski2021-03-161-23/+0
| | | | | | | | | Since all tethering bpf map related functionality is moving to Tethering mainline module. Test: atest, TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I41832008aa7384516e514211c0d8bf14330f1c7e
* remove dead code compiler warns aboutMaciej Żenczykowski2021-03-161-1/+0
| | | | | | Test: atest, TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I3374bfad70d2c492c05da6660a4aafdf05776362
* TetherController - remove a bunch of no longer used RPC support codeMaciej Żenczykowski2021-03-161-55/+0
| | | | | | | | | | | | This is now dead code - it is reimplemented in Java in the tethering mainline module. Test: git grep 'getTetherOffloadStats|getAndClearTetherOffloadStats|setTetherOffloadInterfaceQuota|addOffloadRule|removeOffloadRule|validateOffloadRule' finds nothing Test: atest, TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Ic874726f8a99dd686f81bf7b536cd4840e7f7665
* use proper types for tether limit/stats bpf map keys/valuesMaciej Żenczykowski2021-01-211-2/+2
| | | | | | Test: atest, TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I6161efa2a59fd27ddb84483482f21acf7fdd7f59
* SKIP_IF_BPF_NOT_SUPPORTED is a no-opMaciej Żenczykowski2021-01-121-6/+0
| | | | | | | | | Android S requires devices to support eBPF. Test: builds, atest, TreeHugger Bug: 167500195 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Ia289c2eb59920a5cb37e0be759c71098cc77e3c8
* Add binder call tetherOffloadSetInterfaceQuotaHungming Chen2020-06-051-0/+42
| | | | | | | | | Provide binder calls for setting the limit for the given upstream interface. Bug: 150736748 Test: atest Change-Id: I5def133022ee0ae232972c9ccffccd041b4b47a6
* Add binder call tetherOffloadGetStatsHungming Chen2020-05-291-38/+22
| | | | | | | | | | | | | | | | | | | | This binder call is separated from the existing call tetherGetStats and used for for BPF tether stats. Note that the default value of ifIndex of TetherStatsParcel.aidl is applied for backward compatibility because it is added from this commit. Make netd modules to use netd_aidl_interface-unstable-cpp. Both netd and libnetd_server use unstable aidl for new api tetherOffload* and modified parcel TetherStatsParcel. Generated with: m netd_aidl_interface-update-api Bug: 150736748 Test: atest Change-Id: Ie03834bc40992a4abdc8ef70150569982092b386
* ebpf tethering - add a map to store data limit, part 2Maciej Żenczykowski2020-05-101-0/+4
| | | | | | | | | This is higher level glue code, including dump support. Tested: builds Bug: 150736748 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I9777d38d319a0b9db265aa339b7e903c49b8a4df
* TetherControllerTest: Add tests for getTetherStats with BPF mapsHungming Chen2020-03-051-3/+82
| | | | | | Bug: 149963652 Test: build, atest Change-Id: I5b2186bb9134eee52462c930956ced635fee00ba
* Remove sscanf() in TetherController.waynema2019-01-151-1/+2
| | | | | Test: netd_unit_test, netd_integration_test, libnetd_resolv_test Change-Id: Ibff2d6cc5dbf4fb09fcd1862be1b71be3b1d9f8e
* Nat-related commands refineLuke Huang2018-11-191-47/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need this to ensure that the tethering IPCs don't need to grab the lock in two different controllers The idea is that always having a global_alert rule in bw_global_alert chain. TetherController will enable/disable the reference of bw_global_alert chain. [childchain order of filter FORWARD chain] Chain FORWARD nm_mdmprxy_iface_pkt_fwder oem_fwd fw_FORWARD bw_FORWARD tetherctrl_FORWARD --Simple rule comparison-- [Before] Chain bw_FORWARD Alert rule ... other rules Chain tetherctrl_FORWARD ... other rules [After] Chain bw_FORWARD No Alert rule ... other rules Chain tetherctrl_FORWARD Jump to bw_global_alert ... other rules Chain bw_global_alert Alert rule The exact rule comparison is shown in the bug. Bug:119735985 Test: built, flashed, booted system/netd/tests/runtests.sh passes Change-Id: Ibf752d0c8de9170689fc74c89c0424d2642853ec
* netd: PPTP Helperhiroaki.yokoyama2018-08-271-23/+33
| | | | | | | | | | | | | | | | Enable the conntrack helper for PPTP connections when tethering is started. Bug: 112066349 Test: as follows - Boot device - Pass - Start tethering - Pass - Start PPTP on tethered host (USB) - Pass - make -j64 netd_unit_test adb shell /data/nativetest64/netd_unit_test/netd_unit_test - Pass Change-Id: I547f8b877661c137646b663429d29737678652bf
* netd: Active FTP HelperTyler Wear2018-06-141-0/+8
| | | | | | | | | | | | | | | | | | 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
* Support adding multiple tethering upstreams.Remi NGUYEN VAN2018-03-281-18/+62
| | | | | | | | | | | | | | | | | | | Currently, when the first tethering interface pair is added, we add MASQUERADE rules for the upstream and IPv6 counting rules. Continue to add IPv6 counting rules when the first interface pair is added, but change the code to add MASQUERADE rules every time a new upstream is added. This will allow us to support adding, say, v4-rmnet_data0 as an upstream once we're already using rmnet_data0 as an upstream. Bug: 38218697 Bug: 64382985 Bug: 64976379 Bug: 64995262 Bug: 64380515 Test: netd_unit_test passes, manual: IPv4 or 464xlat tethering works Change-Id: I84078b2241214b3b993ccaf2e590406018df00ff
* Add tests to add/remove/re-add a NAT.Remi NGUYEN VAN2018-03-201-24/+70
| | | | | | | | | | | This is in preparation of work to support multiple upstreams. Test: netd_unit_test still passes with current behavior. Bug: 38218697 Bug: 64382985 Bug: 64976379 Bug: 64995262 Change-Id: I16bdb69fa151c72d77663025bed82259f34a9608
* Don't complain when finding no tether stats.Lorenzo Colitti2017-09-151-4/+21
| | | | | | | | | | | | | | | | | | | | | | TetherController::addForwardChainStats returns an error if it doesn't find any tethering stats. This was fine when we were still using CommandListener, which would not attempt to fetch the stats if tethering was not enabled. Instead of returning an error when no stats are found, return an error only if the output was empty (implying that no headers were found and thus the required rules do not exist). If the output contains headers but no stats, don't return an error. Returning an error was a necessity in the previous code because it had no unit or integration tests, but such measures are not necessary now that we have test coverage. Fix: 65550883 Bug: 65369386 Test: bullhead builds, boots Test: netd_{unit,integration}_test pass Change-Id: Ie32f4d941dd52c8dc9ff09fde26cc97cedf96bc3
* Swap TX and RX in addForwardChainStats for clarity.Lorenzo Colitti2017-09-051-3/+3
| | | | | | | | Bug: 32163131 Bug: 64995262 Test: netd_{unit,integration}_test pass Test: tethering data usage UI reflects actual data usage Change-Id: Icf5b66972d91e9e45e40d7b4989a15f970a78461
* Remove the gettetherstats command.Lorenzo Colitti2017-09-051-44/+33
| | | | | | | | Bug: 32163131 Bug: 64995262 Test: netd_{unit,integration}_test pass Test: tethering data usage UI reflects actual data usage Change-Id: I1722f64cf775e73d71df997f6bae4820133e67bf
* Add a binder RPC for tethering stats.Lorenzo Colitti2017-09-051-2/+2
| | | | | | | Bug: 32163131 Bug: 64995262 Test: netd_{unit,integration}_test pass Change-Id: I9c7dfdaf6b823840b1691761930b53c30a4dcbc3
* Rename natctrl_* iptables rules to tetherctrl_*Lorenzo Colitti2017-08-311-33/+33
| | | | | | | | Bug: 32163131 Bug: 64995262 Test: bullhead builds and boots Test: netd_{unit,integration}_test pass Change-Id: Ifd20920713b2b5b9c22f4c829ef037bbac024505
* Remove support for filtering tether stats.Lorenzo Colitti2017-08-311-56/+14
| | | | | | | | | | | | | | | | The framework does not use this filtering, so it's just dead code. It also requires that NatController publicly expose its list of interface pairs. Also make the parsing code a bit stricter - for example, return an error if any of the lines (except the headers) fail to parse. Bug: 32163131 Bug: 64995262 Test: bullhead builds and boots Test: netd_{unit,integration}_test pass Test: output of "adb shell ndc bandwidth gettetherstats" looks correct Change-Id: Ib7440f935809c59d8b48396764cc63eb95f509b4
* Move all tethering functionality into TetherController.Lorenzo Colitti2017-08-311-0/+351
This includes the entirety of NatController and relevant parts of BandwidthController (specifically, getTetherStats and its dependencies). This will make the code easier to understand and allow netd to privide a simpler API to the framework (e.g., by providing higher-level methods that perform what today are multiple operations from the framework's point of view). It will also reduce duplication of state (e.g., interface pairs kept by NatController partially overlap with downstream interfaces kept by TetherController) and avoid dependencies between controllers. This CL makes no functional changes. The only code changes are the ones necessary for compilation. Specifically: - Move some methods into IptablesBaseTest.cpp so they can be used from two test classes. - Change TetherController::iptablesRestoreFunction to the three-argument used by the erstwhile BandwidthController tests. Where appropriate, variable names have been changed, but strings that actually appear on device, such as iptables rule names, are left as is and will be changed in a future CL. Bug: 32163131 Bug: 64995262 Test: bullhead builds, boots Test: netd_{unit,integration}_test pass Change-Id: Idc80bfd424ce011826305f84b1cc98e741698601