Commit Graph

327 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
231b52bc03 Remove last NetworkStack usage of hidden APIs
Includes various small changes to stop using hidden APIs

Test: make NetworkStack
Test: flashed, booted, WiFi and tethering working
Bug: 112869080
Change-Id: Id2830795a444f484b377ed6437435a1cd833697a
2019-01-30 10:23:24 +09:00
Remi NGUYEN VAN
b8bbc48dee Merge "Move NetworkUtils used by NetworkStack" 2019-01-28 09:06:20 +00:00
Remi NGUYEN VAN
e88516f13b Move NetworkUtils used by NetworkStack
Depending on usage move into NetworkStackUtils or shared
Inet4AddressUtils.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Merged-In: Ie20dcee375b377236004a7689890729493aca857
Change-Id: Ib8d000529872796022706a35050fdc2c7141f2ab
2019-01-28 13:45:17 +09:00
Remi NGUYEN VAN
a4bcc86dbe Add NetworkStack networking deps to SystemApi
Cherry-pick with conflicts fixed in CaptivePortalLoginActivity imports.
Test: atest FrameworksNetTests
Bug: 112869080
Merged-In: Id59dc06fb85e4ac88098f56b621ec880610759ce
Change-Id: I3c05e8fdd70497426d4fa433295c4fbdad07d9c9
2019-01-28 13:28:35 +09:00
Remi NGUYEN VAN
e693d49c0a Merge changes I1250730c,I7d00848c
* changes:
  Create a wrapper for IpClient
  Move IpClient to NetworkStack
2019-01-23 15:05:00 +00:00
Luke Huang
31ff0616d1 Merge changes from topic "Java async dns"
* changes:
  Add asynchronous DNS query API in Java
  Add jni method for DnsResolver
2019-01-23 08:48:23 +00:00
Remi NGUYEN VAN
3c600a15a1 Move IpClient to NetworkStack
Test: atest FrameworksNetTests NetworkStackTests
Bug: b/112869080
Change-Id: I7d00848c052382cd1b6ce458868bed6a1e9e8ec5
2019-01-23 16:44:21 +09:00
Luke Huang
00b15f33ab Add asynchronous DNS query API in Java
DnsResolver for asynchronous DNS querying
DnsPacket for parsing answer

Test: built, flashed, booted
      atest DnsResolverTest
      atest DnsPacketTest

Change-Id: Id014bc7387dd940cfaa270f68e7d4d85fab320a0
2019-01-23 00:07:43 +08:00
Remi NGUYEN VAN
97f69c2f8d Add getAvoidBadWifi system API
This helps remove the dependency on MultinetworkPolicyTracker from
IpClient.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: If56791dbed564772f25a859f301b8b52d84e38a3
2019-01-22 15:57:34 +00:00
Remi NGUYEN VAN
06adb08d27 Merge "Remove InterfaceController dependency on NMS" 2019-01-22 13:14:06 +00:00
Remi NGUYEN VAN
d1b51a3228 Remove InterfaceController dependency on NMS
Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: Ib3773068b087f58f4ac3394291cda132b00b2dcc
2019-01-22 20:25:48 +09:00
Remi NGUYEN VAN
94a055737e Add LinkProps and NetworkCaps methods to SystemApi
Added methods are used by the NetworkStack.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: I8822d43c1a4981ca39289525685b3f975fb0e8d5
2019-01-22 16:57:16 +09:00
Remi NGUYEN VAN
8586a43f31 Merge "Add NetworkStack metrics to system API" 2019-01-22 07:48:39 +00:00
Remi NGUYEN VAN
e7e9f2befe Fix lint errors for moving IpClient to NetworkStack
Test: checklint at upload, m
Bug: 112869080
Change-Id: I82fb9c9037cc0a9d3c80958d64552ff1ef0a90ab
2019-01-22 13:12:08 +09:00
Remi NGUYEN VAN
60b9ad2ec3 Merge "Add IIpClient API for IpClient" 2019-01-22 01:10:17 +00:00
Remi NGUYEN VAN
7b84fb336f Add NetworkStack metrics to system API
Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: Ie52c55f248c173e2a5ee603ecd004fbac9004ac1
2019-01-21 23:24:41 +00:00
Chalard Jean
ca046e898b Merge changes I2ddfef0c,I49bee0c9
* changes:
  [MS08] Read back attributes and blobs.
  [MS07] Implement storeNetworkAttributes and storeBlob.
2019-01-21 09:34:41 +00:00
Remi NGUYEN VAN
a5d31f53b6 Add IIpClient API for IpClient
The API will be used to interact with IpClient once it is moved to the
NetworkStack process.
This change keeps compatibility with the previous API so that clients
can be migrated independently.

Test: atest FrameworksNetTests NetworkStackTests
Bug: b/112869080
Change-Id: I57d8164afae849230bbc0e25f17859c0b22d0f29
2019-01-21 18:25:46 +09:00
Chalard Jean
bf73e66d4d [MS08] Read back attributes and blobs.
Test: New tests in IpMemoryStore
Bug: 113554482

Change-Id: I2ddfef0c2ed37459c038f75d1dfc92fdefbf58f5
2019-01-21 15:21:09 +09:00
Remi NGUYEN VAN
6b0b2b735e Add stable AIDL parcelables for IIpClient API
Test: atest FrameworksNetTests NetworkStackTests
Bug: b/112869080
Change-Id: Ia4ac1eb482850a06c4dc1b6c1fe55d33d4087388
2019-01-21 12:54:24 +09:00
Remi NGUYEN VAN
c37177a7d6 Merge "Add stable AIDL parcelables for LinkProperties" 2019-01-17 08:30:18 +00:00
Remi NGUYEN VAN
4855a2e2c6 Add stable AIDL parcelables for LinkProperties
Test: atest android.net.shared.LinkPropertiesParcelableUtilTest
Bug: b/112869080
Change-Id: I2b69980e25bae9f51fb5b8cd3cafb403e6bd53da
2019-01-17 13:11:12 +09:00
Lorenzo Colitti
dac3918fa1 Test parceling empty LinkProperties.
Test: atest FrameworksNetTests
Change-Id: Iec53a9fdce1ba1db86751ea5f14a11d28be543eb
2019-01-15 12:53:59 +09:00
Lorenzo Colitti
59b34472c9 Add the NAT64 prefix to LinkProperties.
Currently we support exactly one NAT64 prefix. This matches what
other components in the system (Dns64Configuration, clatd, etc.)
support.

Test: atest FrameworksNetTests
Change-Id: I45a11cebe43a5e1c60d50eca7889cb317565b598
2019-01-12 02:16:34 +09:00
Chalard Jean
f89d7bee9e [MS02] Write the skeleton for the IP memory store.
This implements a minimal contract for the IP Memory Store
feature.

Test: Created new tests for parcelable code. For the rest, created
      empty tests, but there is no logic, it's boilerplate day
Bug: 116512211
Change-Id: I15dc6275b370d671385ddfdb058a8b8d39952d6e
2019-01-11 15:01:00 +09:00
Chalard Jean
8c141bdb8f [MS01] Add the IP memory store service.
Bug: 116512211
Test: Added initial tests
Change-Id: I9d9af4097e3e2d7afd9956b9cbfa29a9f9558ae0
2019-01-11 15:00:36 +09:00
Chalard Jean
64e495b274 Merge "Add PCSCF to LinkProperties." 2019-01-10 05:55:05 +00:00
Remi NGUYEN VAN
0e3d0923a6 Move DhcpServer to NetworkStack app
Test: atest FrameworksNetTests && atest NetworkStackTests
Bug: b/112869080

Change-Id: I96c40e63e9ceb37b67705bdd4d120307e114715b
2019-01-09 15:42:16 +09:00
Remi NGUYEN VAN
73105e1143 Fix linter errors in IpServer and its dependencies
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I534b391458433ac24dffe78f287e3c83a264acfd
2019-01-08 11:07:58 +09:00
Remi NGUYEN VAN
761198a05d Add parceling for DhcpServingParams
Introduce a stable AIDL parcel class, DhcpServingParamsParcel, and
methods to convert to and from that class to DhcpServingParams.
This will be used to move DhcpServer to the NetworkStack app.

Test: atest FrameworksNetTests
Bug: b/112869080
Change-Id: I276b7affccb938059769c90a53f0f6beb26e6ede
2019-01-07 12:07:18 +09:00
Junyu Lai
bd73798585 Merge "Ignore ipv6 tx traffic on clat uid." 2019-01-04 09:29:10 +00:00
Remi NGUYEN VAN
9d5e00321f Merge "Replace InterfaceParams with ifName in DhcpServer" 2018-12-18 03:38:24 +00:00
Remi NGUYEN VAN
155da48519 Replace InterfaceParams with ifName in DhcpServer
The current code only uses InterfaceParams#name, and InterfaceParams is
defined in services/net which DhcpServer cannot depend on once moved to
a separate app.

Test: atest FrameworksNetTests
Bug: b/112869080
Change-Id: I94c7dce33200c111666a9dddde82ac2e66a6794f
2018-12-17 15:15:16 +09:00
Aaron Huang
b11a084ebc Merge "apf: Drop ARP reply if SPA is 0.0.0.0" 2018-12-14 03:00:21 +00:00
Aaron Huang
0d9b942292 Merge "Add an APF unit test to drop all packets in the pcap file" 2018-12-13 03:05:56 +00:00
Etan Cohen
bd648ce246 [CM] Fix comments, add tests to TransportInfo API
Bug: 117605977
Test: atest NetworkCapabilitiesTest
Change-Id: I734ec56e44cd09d11ae81a856a53a26e1191b9a0
2018-12-11 15:00:10 -08:00
Aaron Huang
04ed6a3592 apf: Drop ARP reply if SPA is 0.0.0.0
Some network re-writing packet from broadcast MACs to unicast,
result in this kind of packets cannot be dropped by APF filter.
Thus, drop ARP reply if source IP is 0.0.0.0.

Note: Linux kernel always ignores such replies in the function arp_process().

Bug: 118044271
Test: runtest frameworks-net -c android.net.apf.ApfTest
Change-Id: Id293bf231913d9b483ce7d8dd909e05fa927ccd7
2018-12-10 14:18:14 +00:00
Aaron Huang
785e5f1f96 Add an APF unit test to drop all packets in the pcap file
Read a pcap file and runs it through APF filter, then checks whether all
packets in the file are dropped.

Test: runtest frameworks-net -c android.net.apf.ApfTest
Change-Id: I7fc59864608762cd2bc84131817183846b0bf5b5
2018-12-10 21:05:14 +08:00
junyulai
f6ebf4ae08 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
0882543a12 Merge "Refactoring of deleting stats in NetworkStats based on uids." 2018-12-10 05:15:28 +00:00
Treehugger Robot
4e780bd992 Merge "Increase the IpClientTest timeouts to reduce flake rate." 2018-12-09 04:23:19 +00:00
Etan Cohen
ca9fb56ee4 [CS] Add a generic transport-specific information API
Add a generic transport-specific information container interface and
access methods. These can be used by a network factory to pass transport
(bearer)-specific network parameters to the app.

Bug: 117605977
Test: atest frameworks/base/tests/net/java/android/net (+new unit tests)
Change-Id: Ib7c83b677e1c02a2212265719813e648b0c9cc1b
2018-12-07 17:37:48 +00:00
Lorenzo Colitti
87c7dffc35 Increase the IpClientTest timeouts to reduce flake rate.
Fix: 120131319
Test: atest FrameworksNetTests
Change-Id: Ibb70fa74c71608fd76e85636607e860dd58c404a
2018-12-07 19:02:20 +09:00
junyulai
8b8684abc9 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
Hongshik
fa42501e5e Add PCSCF to LinkProperties.
Some applications or services are needed PCSCF address to register IMS server but there is no way to get it on Android Framework.
We have added PCSCF address to LinkProperties like attached diff files.

Test: get Linkproperties and check Pcscf addresses.
      atest FrameworksNetTests

Change-Id: Ic2341a4ce2ed88d560325721766fc21f85f7ff86
Signed-off-by: Hongshik <hshik.kim@samsung.com>
2018-12-05 22:05:49 +09:00
Benedict Wong
781dae6306 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
Etan Cohen
a8923c5aea Add IPv6 link-local address generation from EUI-48
Add a utility method to convert an EUI-48 to an IPv6 link-local
address based on RFC 4291 (EUI-64 generation) followed by RFC 4862.

Bug: 117605977
Test: atest MacAddressTest
Merged-In: I80b683e69da6beff3b37fc345fc15aa9610d09b7
Change-Id: I80b683e69da6beff3b37fc345fc15aa9610d09b7
2018-11-16 21:50:24 -08:00
junyulai
c33ac0d43b 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
77017913a4 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
Mike Yu
f9729757f9 Add tests for the network blocked status change
onBlockedStatusChanged is intruduced for network blocked status.
The changes in this patch are:
  - Test onBlockedStatusChanged which tells apps whether the
    network is blocked.
  - Fixed the tests which is affected by the order changed in
    onAvailable.

Test: as follows
    - runtest frameworks-net
    - runtest -x NetworkPolicyManagerServiceTest.java
Bug: 74575553
Change-Id: I383c037ed895ef69c478dc3cff69fb1e27c42845
2018-10-19 19:52:50 +08:00