Commit Graph

5 Commits

Author SHA1 Message Date
Ken Chen b9266bf507 Add traffic_controller, networkstats, netd_updatable tests to MTS.
In order to get counted by mts code coverage, these native tests need to
be run as part of mts.

Bug: 233904825
Test: m mts && mts-tradefed run mts-tethering-coverage
Change-Id: I79313197b146c7043ffb5e164faa46c2e16dd1d2
2022-05-27 15:00:18 +00:00
Bob Badour 4ef4a444e8 [LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity
Added SPDX-license-identifier-Apache-2.0 to:
  netd/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: Ib1377fbb050fe52ee195eec58fea67ef769a487a
2022-02-10 10:57:23 -08:00
Maciej Żenczykowski dcae351663 link libbase & libnetdutils dynamically - save ~17.5 kiB
Before:
  $ adbz root && adbz wait-for-device && adbz shell ls -l /apex/com.android.tethering/{bin/for-system,lib,liv64}
  /apex/com.android.tethering/bin/for-system:
= -rwsr-sr-x 1 clat clat 18412 1969-12-31 16:00 clatd

  /apex/com.android.tethering/lib:
= -rw-r--r-- 1 system system  64560 1969-12-31 16:00 libandroid_net_connectivity_com_android_net_module_util_jni.so
= -rw-r--r-- 1 system system 713636 1969-12-31 16:00 libc++.so
= -rw-r--r-- 1 system system  13596 1969-12-31 16:00 libframework-connectivity-jni.so
d -rw-r--r-- 1 system system 212624 1969-12-31 16:00 libnetd_updatable.so
d -rw-r--r-- 1 system system 948044 1969-12-31 16:00 libservice-connectivity.so

After:
  $ adbz root && adbz wait-for-device && adbz shell ls -l /apex/com.android.
  /apex/com.android.tethering/bin/for-system:
= -rwsr-sr-x 1 clat clat 18412 1969-12-31 16:00 clatd

  /apex/com.android.tethering/lib:
= -rw-r--r-- 1 system system  64560 1969-12-31 16:00 libandroid_net_connectivity_com_android_net_module_util_jni.so
+ -rw-r--r-- 1 system system 251404 1969-12-31 16:00 libbase.so
= -rw-r--r-- 1 system system 713636 1969-12-31 16:00 libc++.so
= -rw-r--r-- 1 system system  13596 1969-12-31 16:00 libframework-connectivity-jni.so
d -rw-r--r-- 1 system system  45584 1969-12-31 16:00 libnetd_updatable.so
+ -rw-r--r-- 1 system system  95872 1969-12-31 16:00 libnetdutils.so
d -rw-r--r-- 1 system system 749980 1969-12-31 16:00 libservice-connectivity.so

Delta: -212624-948044+251404+45584+95872+749980 == -17828

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id88468442c4f3f24d5bca96b75effb69f20038bf
2022-02-02 18:03:23 -08:00
Maciej Żenczykowski f8943ea3bc link libbase statically into libnetd_updatable - saves ~85 kB
Before (aosp_cf_x86_phone-userdebug):
  $ adbz shell ls -l /apex/com.android.tethering/lib
  -rw-r--r-- 1 system system 251404 1969-12-31 16:00 libbase.so
  -rw-r--r-- 1 system system 713636 1969-12-31 16:00 libc++.so
  -rw-r--r-- 1 system system  64560 1969-12-31 16:00 libcom_android_connectivity_com_android_net_module_util_jni.so
  -rw-r--r-- 1 system system  13596 1969-12-31 16:00 libframework-connectivity-jni.so
  -rw-r--r-- 1 system system  45776 1969-12-31 16:00 libnetd_updatable.so
  -rw-r--r-- 1 system system 948032 1969-12-31 16:00 libservice-connectivity.so

After (aosp_cf_x86_phone-userdebug):
  $ adbz shell ls -l /apex/com.android.tethering/lib
  -rw-r--r-- 1 system system 713636 1969-12-31 16:00 libc++.so
  -rw-r--r-- 1 system system  64560 1969-12-31 16:00 libcom_android_connectivity_com_android_net_module_util_jni.so
  -rw-r--r-- 1 system system  13596 1969-12-31 16:00 libframework-connectivity-jni.so
  -rw-r--r-- 1 system system 212624 1969-12-31 16:00 libnetd_updatable.so
  -rw-r--r-- 1 system system 948032 1969-12-31 16:00 libservice-connectivity.so

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I19c9d73ba3555bbc1987fbdc0be19af1f0511948
2022-01-31 19:56:33 -08:00
Ken Chen 1647f60d66 [NETD-BPF#19] Mainline part of bpf code from netd
1. Add libnetd_updatable.so in com.android.tethering. The library is
loaded by netd. Currently, it mainly targets on a few functions which
access BPF maps. The functionality may extend in the future.

2. Attach gcroup progs from libnetd_updatable.so.

3. Move (privileged)TagSocket and untagSocket implementation to mainline
module. Combine privilegedTagSocket and untagSocket into a single
function.

4. Split related unit tests from netd_unit_test to
libnetd_updatable_unit_test as well.

Bug: 202086915
Test: cd system/netd; atest
Test: atest TrafficStatsTest NetworkUsageStatsTest

Change-Id: Ib556458103a4cbb643c1342d9b689ac692160de0
2022-01-30 09:51:25 +08:00