Commit Graph

1459 Commits

Author SHA1 Message Date
Nick Kralevich
7b51a98e96 Merge "jni: more O_CLOEXECs"
am: 0bd511611e

Change-Id: Id9eabfa92a488dbf7a27108aff8101d602e1adc9
2019-01-28 20:31:59 -08:00
Nick Kralevich
cac3986f14 jni: more O_CLOEXECs
Prevent FDs from leaking across an execve() boundary.

Test: compiles and boots
Change-Id: I5f91046917b55b6abead0a5c6e939f82814e6f18
2019-01-28 10:39:10 -08:00
Chenbo Feng
03074c729f Merge "Use delta reads for per uid traffic stats"
am: 39de2905a5

Change-Id: I17faec2cc2a73e56d0f19abad32154b378857fc4
2019-01-24 10:55:09 -08:00
Chenbo Feng
39de2905a5 Merge "Use delta reads for per uid traffic stats" 2019-01-24 18:16:25 +00:00
Remi NGUYEN VAN
fef17fd05f Merge changes I1250730c,I7d00848c
am: e693d49c0a

Change-Id: I2f19490a2340bdc2630162dfe9a277dffc5041fa
2019-01-23 08:26:33 -08:00
Remi NGUYEN VAN
63e61c427d Move IpClient to NetworkStack
Test: atest FrameworksNetTests NetworkStackTests
Bug: b/112869080
Change-Id: I7d00848c052382cd1b6ce458868bed6a1e9e8ec5
2019-01-23 16:44:21 +09:00
Chenbo Feng
a9382c9793 Use delta reads for per uid traffic stats
For the detailed network stats of each uid and tag, the native
implementation provides delta read instead of consistent stats
data since boot. Every time the readNetworkStatsDetail function gets
called, the data pulled will be cleared. We will keep a persistent data
since boot in NetworkStatsService instead.

Fixed some checkstyle complains in related files as well.

Bug: 79171384
Test: android.app.usage.cts.NetworkUsageStatsTest
      NetworkStatsServiceTest
Change-Id: I50bcf278739135081d522e50b0e88d76fd9ab131
2019-01-22 13:50:35 -08:00
junyulai
19ec97e903 resolve merge conflicts of da290bec0c5418e758b92abad7be8e729cf37d68 to stage-aosp-master
Bug: None
Test: I solemnly swear I tested this conflict resolution.

Change-Id: I719965f13d1f726fdac5b475fd8733b07e28f5b6
Merged-In: I3d94acb71c142ec38b750e58822881ff383341cc
2019-01-21 12:22:13 +00:00
Mike SU
3657ce9690 fix getIfaceStats and getTotalStats bug
root cause: getIfaceStats and getTotalStats is directly reading
iface_stat_fmt or eBPF, not include tether stats.
solution: add tether stats to getIfaceStats and getTotalStats.

Bug: 120039819
Test case1:
1. tether offload is enabled on phone, enable MHS on phone.
2. Use test app to check getMobileRxBytes->getIfaceStats
3. Download 10M file on MHS client
4. Use test app to check getMobileRxBytes->getIfaceStats again
result: getMobileRxBytes increased around 10M

Test case2:
1. tether offload is disabled on phone, enable MHS on phone.
repeat above step 2~4
result: getMobileRxBytes increased around 10M

Following CTS cases passed
run cts -m CtsNetTestCases --test android.net.cts.TrafficStatsTest
run cts -m CtsUsageStatsTestCases --test android.app.usage.cts.NetworkUsageStatsTest

Change-Id: I3d94acb71c142ec38b750e58822881ff383341cc
2019-01-10 12:16:25 -06:00
Chenbo Feng
37cec67bdc Merge "Adjust map names due to new bpfloader"
am: 0317e9e374

Change-Id: If97a15a7f7b6a066bbf46db3497270a8c9a81026
2019-01-09 10:53:22 -08:00
Treehugger Robot
0317e9e374 Merge "Adjust map names due to new bpfloader" 2019-01-09 18:34:49 +00:00
junyulai
ac828b9ad4 [automerger skipped] Merge "DO NOT MERGE: Revert: use legacy way to get tcp packet count"
am: a1e93d0a66 -s ours
am skip reason: subject contains skip directive

Change-Id: I3b55e5cac6168719dc586013707c8d270b148206
2019-01-08 21:19:09 -08:00
Treehugger Robot
a1e93d0a66 Merge "DO NOT MERGE: Revert: use legacy way to get tcp packet count" 2019-01-09 05:10:05 +00:00
junyulai
579bf97659 DO NOT MERGE: Revert: use legacy way to get tcp packet count
In Q, legacy way to get tcp packet count is not planned to be
supported. Users who use this unsupported API e.g., data stall
detection are also planned to be removed.

Thus, this change reverts 0b4a66a1c2 which is the short term
solution in P.

Bug: 110443385
Test: atest FrameworksNetTests
Change-Id: Ia09f908edbf194b9aa873a3bdd5aee7b6fcb16bc
2019-01-09 10:38:32 +08:00
Chenbo Feng
150dc6f187 Adjust map names due to new bpfloader
With the new loader support added. The bpf map format is defined by bpf
kernel program as well. Change the netd bpf program to the new format.

Test: CtsUsageStatsTestCases
Bug: 112334572
Change-Id: I34e38e0a8cf0cca54dc52ec897771452f9d90525
2019-01-04 12:06:35 -08:00
Junyu Lai
9c0075aad0 Merge "Ignore ipv6 tx traffic on clat uid."
am: 191f32fdc7

Change-Id: I181c3c812caa9bcd359fbddf74d14adeb7e83419
2019-01-04 08:13:29 -08:00
Junyu Lai
191f32fdc7 Merge "Ignore ipv6 tx traffic on clat uid." 2019-01-04 09:29:10 +00:00
Xin Li
c8c0caf117 [automerger skipped] Merge "DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master"
am: ab3b396c45  -s ours

Change-Id: I7710a0b1a5ba1bf7acd45d694818aec91853e546
2018-12-13 12:47:28 -08:00
Xin Li
964a5fb469 [automerger skipped] DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
am: 6f9c73f8c9  -s ours

Change-Id: I60ae19c5ff7d5de669fac1ebd93d48283d9f27d8
2018-12-13 11:18:53 -08:00
Chenbo Feng
76b4d2fba2 Merge "Delete unused import"
am: e726c2654d

Change-Id: I8249bd4340b6e6e2e0a4fa687207198b534168b1
2018-12-12 22:18:40 -08:00
Treehugger Robot
ab3b396c45 Merge "DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master" 2018-12-13 05:45:20 +00:00
Chenbo Feng
f9eff38d9b Delete unused import
The hasBpfSupport() check from BpfUtils is not used by the native helper
in framework. Remove them.

Bug: 111441138
Test: Build without failure.
Change-Id: Icdd01bf1a03efd7883e4939d0d730303ec1004e7
2018-12-13 00:46:20 +00:00
Adrian Roos
ee2ba33204 Merge "API: Clean up redundant and ineffective usages of SystemApi and TestApi"
am: af0e1c2fa5

Change-Id: I016cacee1e1de6c7a8269fc3605ed25716598d9e
2018-12-12 08:33:17 -08:00
Adrian Roos
be53fbb8d5 API: Clean up redundant and ineffective usages of SystemApi and TestApi
Everything that is marked SystemApi or TestApi, but not @hide is still
part of the public SDK, it is therefore not sound to have that combination.

In the future, specifing such a combination will be considered an error
to prevent inadvertently exposing SystemApi and TestApi as public API.

Bug: 115333477
Change-Id: Ibd5d6a22862fdbc1e20a1cb3925280f5a682edea
Merged-In: Ibd5d6a22862fdbc1e20a1cb3925280f5a682edea
Test: METALAVA_PREPEND_ARGS="--error UnhiddenSystemApi" m checkapi
Exempt-From-Owner-Approval: API cleanup
2018-12-12 15:02:26 +01:00
Xin Li
6f9c73f8c9 DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
Bug: 120502534
Change-Id: Idc8bfb6d97a869b76cfb87ca1a494201baf9e8bd
2018-12-11 14:13:44 -08:00
Xin Li
07ea8a407d DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into stage-aosp-master
Bug: 120502534
Change-Id: I7351a1832c4bd2fd86324183ab83e9088d716822
2018-12-10 12:30:19 -08:00
junyulai
6fe079615b Ignore ipv6 tx traffic on clat uid.
Currently, 464xlat counts its ipv6 tx traffic into root uid.
When user is making ipv4 upload over ipv6-only network, ipv4
tx traffic may sometimes be counted faster then ipv6 tx
traffic.

Thus, NetworkStatsService may detect non-monotonic values due
to 464xlat adjustment.

So the solution is that: for clatd, make ipv6 tx traffic counts
into clat uid, and then ignore it in the framework side.

Bug: 118602783
Test: 1. manually verify clatd traffic on clat uid.
      2. runtest frameworks-net

Change-Id: Ifb478b79e3e281918c70e16d1f90682c78f33db1
2018-12-10 15:19:03 +08:00
Junyu Lai
2d00948a0c Merge "Refactoring of deleting stats in NetworkStats based on uids."
am: c8dcfb8b4b

Change-Id: I60b086861a9a91cdd54c56c7caf21d26a6dd294a
2018-12-09 21:38:59 -08:00
Junyu Lai
c8dcfb8b4b Merge "Refactoring of deleting stats in NetworkStats based on uids." 2018-12-10 05:15:28 +00:00
junyulai
bbaddec5d7 Refactoring of deleting stats in NetworkStats based on uids.
In follow-up commits, current API would create new NetworkStats
every time when 464xlatAdjustment wants to filtered out some
uids.

This commit refactors it to delete stats in-place to get better
performance.

Bug: 118602783
Test: atest FrameworksNetTests
Change-Id: I858f95d1fa7733111786243b4e261ce8a70a068d
2018-12-06 19:01:17 +09:00
Luke Huang
7d5693279a Merge "Use ParcelFileDescriptor instead of FileDescriptor in INetd.aidl"
am: d6c2dc5908

Change-Id: I87360c19d58de38772f95ba8123a559007c6e71d
2018-12-04 22:21:26 -08:00
Bill Yi
d5fda04e91 Merge pi-qpr1-release PQ1A.181105.017.A1 to pi-platform-release
Change-Id: Id08fdcae21e3ceb54e893a9ed11da6e67c889895
2018-11-28 18:45:59 -08:00
Luke Huang
d913fb44ad Use ParcelFileDescriptor instead of FileDescriptor in INetd.aidl
Stable aidl won't support FileDescriptor but ParcelFileDescriptor.
In order to migrate to stable aidl, replace all FileDescriptor in
INdetd.aidl.

Test: runtest frameworks-net passes
Change-Id: Icdf37aed0e0cce0352070a437066e77c0f2fd85a
2018-11-28 13:41:58 +08:00
Benedict Wong
719761f60c Merge changes from topic "xfrmi-support"
am: f928c1e4b9

Change-Id: I9b76a58ab9ebdb9abb01216e8b3916f1f52f9267
2018-11-25 19:15:37 -08:00
Benedict Wong
c6fcedd779 Cleanup and update comments SA mark disabling comments
This commit cleans up and upates comments with regard to changes in
aosp/721999, clarifying the restrictions and potential pitfalls we would
see with regards to IPsec tunnel mode without updatable SAs.

Bug: 111854872
Test: Compiles, comment-only change
Change-Id: I07b0063987463c1a3cf42e112839a31739947c80
2018-11-21 22:50:52 -08:00
Benedict Wong
5d74984c24 Add XFRM-I support to IpSecService
This change adds support for XFRM-I to all IpSecService netd calls.
Fallback logic is in netd, and thus both VTI and XFRM-I parameters are
always passed down to IpSecService.

Bug: 78589502
Test: All java, CTS tests passing
Change-Id: Ie4186f0ad7e50763b21831f6fa411b5ee436de78
2018-11-21 08:34:54 -08:00
Benedict Wong
683441d87a Disable attempted updating of SA marks
SA marks are never updated during the UPDSA call. This change disables
the attempts to update the specified SAs, ensuring that the config
stored in IpSecService matches that of the allocated kernel resources.

Bug: 111854872
Test: Unit, CTS tests passing
Change-Id: Ic1fb862c8021ffa260c3e262ec698d8af0a826d9
2018-11-21 08:34:54 -08:00
Junyu Lai
40de2a46a3 Merge "Change types of fields of network stats reported to framework."
am: 2c0a0092f1

Change-Id: I82da681df48cd6425bbfb962d3969fa236e9db29
2018-11-13 01:37:17 -08:00
junyulai
6d49d8da7e Change types of fields of network stats reported to framework.
Currently, NetworkStats use int to handle uid, set and tag,
while native side using unsigned int mixing with signed int
with that. This commit make necessary changes in JNI part while
libnetdbpf unifying the types of fields.

Bug: 112226716
Test: 1. manually reconnect vpn
      2. update apps from playstore
      3. atest libnetdbpf_test
      4. runtest frameworks-net
      5. cts-tradefed run cts -m CtsUsageStatsTestCases -t \
              android.app.usage.cts.NetworkUsageStatsTest

Change-Id: I6c27124db8292e2825fba51b8994f013897cb566
2018-11-08 23:07:00 +08:00
Junyu Lai
a38302f84f Merge "Fix negative uid stats caused by 464xlat adjust when eBPF is on."
am: 0d63da86e2

Change-Id: Ia5120619ce7d5cedd6e558ed4d1dc9a706638796
2018-10-30 19:35:32 -07:00
junyulai
7d412d0b46 Fix negative uid stats caused by 464xlat adjust when eBPF is on.
When using xt_qtaguid to count per uid stats,
NetworkStatsService needs to adjust the 464xlat traffic since
iptables module would double count for ipv4 and ipv6 packet.
But for eBPF, the per uid stats is collected in a different
hook, so the adjustment on root uid would only be needed in tx
direction.

Bug: 112226716
Test: 1. Make ipv4 traffic in ipv6-only network and check data
         usage.
      2. Make ipv4 traffic in a client which connect to
         ipv6-only hotspot.
      3. runtest frameworks-net
      4. cts-tradefed run cts -m CtsNetTestCases -t \
                 android.net.cts.TrafficStatsTest
      5. cts-tradefed run cts -m CtsUsageStatsTestCases

Change-Id: Ic9a84f5446eddc943c255d5f3b89dad171f53cac
2018-10-30 21:23:38 +08:00
Luke Huang
96c61c9fa2 Merge "Refactor UidRange by using stable aidl structure"
am: 55012f2249

Change-Id: I9ac52f3869fe051d0ef7f45768f1defad155b53b
2018-10-28 17:44:20 -07:00
Treehugger Robot
55012f2249 Merge "Refactor UidRange by using stable aidl structure" 2018-10-29 00:17:34 +00:00
Bill Yi
13a634886b [automerger skipped] Merge pie-platform-release to aosp-master - DO NOT MERGE
am: 567b439367  -s ours

Change-Id: I2c4b9184789a1bdae2cec06e0e72f6c6ca049113
2018-10-24 17:17:46 -07:00
Bill Yi
567b439367 Merge pie-platform-release to aosp-master - DO NOT MERGE
Change-Id: I695db52f5e22509401258e8b083e7650d401d993
2018-10-24 14:48:44 -07:00
Bill Yi
ef4374f6a2 Merge pi-platform-release to stage-aosp-master - DO NOT MERGE
Change-Id: I13571b072111900d0979f026670e648cdef9899b
2018-10-24 09:08:38 -07:00
Luke Huang
e67f2178dc Refactor UidRange by using stable aidl structure
Use stable aidl generated structure instead of UidRange

Test: runtest frameworks-net passes
Test: manual testing of UidRange related function works
Change-Id: Iaf1c10777dc1e71df2be2a57533a10257b12626b
2018-10-24 19:45:09 +09:00
Chenbo Feng
d271be0e1c Merge "Move bpf project to system/bpf"
am: 1006d271cc

Change-Id: I0a96a2abd66fd0cca4b49d773a6990a59134128a
2018-10-17 13:55:43 -07:00
Chenbo Feng
4a259ab940 Move bpf project to system/bpf
The bpf project now have a new project directory in system/bpf instead
of inside netd. The network related bpf library is renamed to
libnetdbpf. Fix the dependency issue in framework to make sure no
regression.

Test: -m CtsNetTestCases -t android.net.cts.TrafficStatsTest
Bug: 112334572
Change-Id: Ibd477bf17d18d516aa520fb1569f4a395ef9abf0
2018-10-17 03:46:35 +00:00
Android Build Merger (Role)
f3f46416d0 Merge changes into stage-aosp-master 2018-10-15 22:44:53 +00:00