Commit Graph

745 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
894533059e Add SocketUtils for NetworkStack
These utilities can only be used for privileged apps. The underlying
implementation cannot be @SystemApi.

Test: m
Bug: 112869080
Change-Id: Idfa90561102e5b03ab2b79486d3ad46457128bf8
2019-01-28 20:11:27 +09:00
junyulai
1677ea7de5 Hide Keepalive offload API in IpSec
Since the new keepalive API is exported in ConnectivityManager,
hide Keepalive API in IpSec, also make system-current.txt sync
for this part.

Bug: 114151147
Test: m -j
Change-Id: I076030bdbab1cd7d69f6a034577d529970b050dc
2019-01-25 14:41:19 +08:00
Chenbo Feng
ac4d7d1258 Merge "Use delta reads for per uid traffic stats" am: 39de2905a5 am: 03074c729f
am: cf8d605cfb

Change-Id: Ia2d3aad715dc1a2ff65ea9ec1a5badeda47c47a6
2019-01-24 11:57:26 -08: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
Chenbo Feng
14c16b87a9 Merge "Adjust map names due to new bpfloader" am: 0317e9e374 am: 37cec67bdc
am: 50252f86f3

Change-Id: Iedbb541ba2fa5916048e3f40d5cc128a83d0dc6b
2019-01-09 11:34:54 -08:00
Treehugger Robot
0317e9e374 Merge "Adjust map names due to new bpfloader" 2019-01-09 18:34:49 +00: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
92c56063be Merge "Ignore ipv6 tx traffic on clat uid." am: 191f32fdc7 am: 9c0075aad0
am: 59c7f1a494

Change-Id: I1ac85ac863026ea99117c5b0115bcc0c9144fb7b
2019-01-04 08:47:41 -08:00
Junyu Lai
191f32fdc7 Merge "Ignore ipv6 tx traffic on clat uid." 2019-01-04 09:29:10 +00:00
Chenbo Feng
e817e16c32 Merge "Delete unused import" am: e726c2654d am: 76b4d2fba2
am: 6f97b16072

Change-Id: I577371244d45a3b93e3e5f4a02747a51fd42d363
2018-12-13 11:20:14 -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
Adrian Roos
ef420e9754 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
Test: METALAVA_PREPEND_ARGS="--error UnhiddenSystemApi" m checkapi
Exempt-From-Owner-Approval: API cleanup
2018-12-11 20:38:02 +01: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
Junyu Lai
83a52f5fb2 Merge "Refactoring of deleting stats in NetworkStats based on uids." am: c8dcfb8b4b am: 2d00948a0c
am: 2d79ef94f8

Change-Id: I29c57276424464afd54e184c369d30a5e9707f14
2018-12-10 03:10:15 -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
2d79ef94f8 Merge "Refactoring of deleting stats in NetworkStats based on uids." am: c8dcfb8b4b
am: 2d00948a0c

Change-Id: Icfe86f71f9416dcd5fcc9aafd8c346197cde7cff
2018-12-09 21:46:07 -08: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
Benedict Wong
a041d6fb80 Merge changes from topic "xfrmi-support" am: f928c1e4b9 am: 719761f60c
am: 0cfc49485c

Change-Id: I9c543d38c88181b12cdbc7bdb93d7e38f1dfd425
2018-11-25 19:38:35 -08:00
Benedict Wong
0cfc49485c Merge changes from topic "xfrmi-support" am: f928c1e4b9
am: 719761f60c

Change-Id: I13a826f5ae3c4cb700be789b369848685da1bc41
2018-11-25 19:26:26 -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
11e2cb862b Merge "Change types of fields of network stats reported to framework." am: 2c0a0092f1 am: 40de2a46a3
am: 979209a2a3

Change-Id: Iab166b8b06d3a744b8cfc83e0467c478642ce185
2018-11-13 02:03:05 -08:00
Junyu Lai
979209a2a3 Merge "Change types of fields of network stats reported to framework." am: 2c0a0092f1
am: 40de2a46a3

Change-Id: I0bf2bdc56f46928b94f0954e799d51196171fdc4
2018-11-13 01:53:45 -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
0ab82da19f Merge "Fix negative uid stats caused by 464xlat adjust when eBPF is on." am: 0d63da86e2 am: a38302f84f
am: fcb523e095

Change-Id: I9d0d8b67ed0159ba2a71059620ebe5698eb79ccb
2018-10-30 19:56:01 -07:00
Junyu Lai
fcb523e095 Merge "Fix negative uid stats caused by 464xlat adjust when eBPF is on." am: 0d63da86e2
am: a38302f84f

Change-Id: I3ee791e4b6fdd9d508807810183dc02c69bd2c0b
2018-10-30 19:46:18 -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
4f2898674e Merge "Refactor UidRange by using stable aidl structure" am: 55012f2249 am: 96c61c9fa2
am: 9a3586aa00

Change-Id: I82e06fe93a3ed88368b649ef8d3283322191ffe7
2018-10-28 18:06:15 -07:00
Luke Huang
9a3586aa00 Merge "Refactor UidRange by using stable aidl structure" am: 55012f2249
am: 96c61c9fa2

Change-Id: I09ac7fc6525948b76114ef936dc1b3d2d1bae0fb
2018-10-28 17:55:57 -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
9a7e9521fd Merge "Move bpf project to system/bpf" am: 1006d271cc am: d271be0e1c
am: e6278480b9

Change-Id: I4126f4e184975a387a82ada2b4f432cf20cabbb8
2018-10-18 09:13:56 -07:00
Chenbo Feng
e6278480b9 Merge "Move bpf project to system/bpf" am: 1006d271cc
am: d271be0e1c

Change-Id: I9c0592365844836dc644d6e090def32af3edf678
2018-10-18 08:12:41 -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
Chenbo Feng
684c94973c Merge "Don't check qtaguid file unless using them" am: 0ce43570f5 am: 8eb31202df
am: b127d68ca2

Change-Id: Ibbb10778c6e12c64275c179c8d984306fcb27b4f
2018-09-28 12:52:12 -07:00
Chenbo Feng
b127d68ca2 Merge "Don't check qtaguid file unless using them" am: 0ce43570f5
am: 8eb31202df

Change-Id: I6be72bb22da1aeed8dfe5eb4bbb05d8cfd9b4257
2018-09-28 12:32:50 -07:00
Chenbo Feng
5c0232c572 Don't check qtaguid file unless using them
The proc file of xt_qtaguid module is not necessarily exist on future
devices. We should only check it if the device need to read the stats
file for network usage information.

Bug: 79938294
Test: NetworkUsageStatsTest TrafficStatsTest
Change-Id: I5ac6feef8b9a26daa68b381a985925e24b0d80af
2018-09-14 16:13:14 -07:00
Remi NGUYEN VAN
33ca705a18 Merge "Add DhcpServer" am: e3a0f42e8e am: 7f3130c488
am: fb294eb16e

Change-Id: I602efdb3cb4b3316dada80361381404af1c3615c
2018-08-28 20:51:09 -07:00
Remi NGUYEN VAN
fb294eb16e Merge "Add DhcpServer" am: e3a0f42e8e
am: 7f3130c488

Change-Id: Ic3b1cd87389ade162c1c7441132f3e0451f1b78c
2018-08-28 20:42:08 -07:00
Remi NGUYEN VAN
c9fc125bb4 Add DhcpServer
This first version can serve discover/request/release, although there
are some small behavior changes with current implementation which will
be addressed later.

Also removes final modifiers on start() and stop() in FdEventsReader, to
allow mocking the methods in tests with the current mockito lib.

Test: Added tests pass, manual: flashed a device using the server
Change-Id: I025366ff7d51c4ba31152af50f3dd2b5e280a54d
2018-08-28 12:50:47 +09:00
Mathew Inwood
add296617f Merge "Add @UnsupportedAppUsage annotations" am: 90660f8990
am: 7a5bf4e2dd

Change-Id: I99215dd5430968df2e2dd514d21b396b00c1403e
2018-08-16 03:29:58 -07:00
Mathew Inwood
b5d1f26d20 Merge "Add @UnsupportedAppUsage annotations" am: d08509363c
am: d825eeefa4

Change-Id: I52585645e23519cfc6d216e344710ad76aeea9e8
2018-08-16 03:10:41 -07:00
Mathew Inwood
90660f8990 Merge "Add @UnsupportedAppUsage annotations" 2018-08-15 15:41:26 +00:00
Mathew Inwood
98639c2c19 Merge "Add @UnsupportedAppUsage annotations" 2018-08-15 11:36:32 +00:00
Mathew Inwood
ce3a48c05f Add @UnsupportedAppUsage annotations
For packages:
  android.net.wimax
  android.net.wifi.p2p.nsd
  android.net.wifi.p2p
  android.net.wifi.hotspot2.pps
  android.net.wifi.hotspot2.omadm
  android.net.wifi.hotspot2
  android.net.wifi.aware
  android.net.wifi
  android.net.util
  android.net.sip
  android.net.rtp
  android.net.nsd
  android.net.metrics
  android.net.lowpan
  android.net.http
  android.net.captiveportal
  android.net

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: Ie25423113ee1a8071cd5039382c00de6ce0af7fd
Merged-In: I520be7a4c79e68310c12e4f55bf66acaa94145a1
2018-08-14 14:44:29 +01:00
Mathew Inwood
ac005192ea Add @UnsupportedAppUsage annotations
For packages:
  android.net.wimax
  android.net.wifi.p2p.nsd
  android.net.wifi.p2p
  android.net.wifi.hotspot2.pps
  android.net.wifi.hotspot2.omadm
  android.net.wifi.hotspot2
  android.net.wifi.aware
  android.net.wifi
  android.net.util
  android.net.sip
  android.net.rtp
  android.net.nsd
  android.net.metrics
  android.net.lowpan
  android.net.http
  android.net.captiveportal
  android.net

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I520be7a4c79e68310c12e4f55bf66acaa94145a1
2018-08-14 14:39:24 +01:00