Commit Graph

42637 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
668f279e83 [automerger skipped] Jarjar all classes in service-connectivity am: b240e2a86e -s ours
am skip reason: Merged-In I2aadeca32751267b74d4fd2fd93bb3e8c62e46c0 with SHA-1 0755183fae is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15261893

Change-Id: Id04321d1ce840c10b33211ed847b80838b9216f2
2021-07-13 12:45:03 +00:00
Nucca Chen
5cdd98b850 Merge "[CTT-7] Delete the rules while half-closing tcp state entered" am: f7c8cec604 am: d0b818fa8a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755173

Change-Id: Id9d4f2be4e4c0d7840a5d336855dfff92f9666fe
2021-07-13 12:31:20 +00:00
Nucca Chen
523e11ef67 Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules" am: db30678605 am: f22f935082
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760692

Change-Id: I759b26fa36116578c84fd6c226725ece3fbe5b7c
2021-07-13 12:31:16 +00:00
Nucca Chen
709d91215f Merge "[CTT-5] Stop update TCP conntrack entry timeout" am: 69ccea4839 am: 23e3eadde5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760691

Change-Id: Idf2680669d1c881f3d1846f379f5a8163c4ac274
2021-07-13 12:31:10 +00:00
Nucca Chen
d0b818fa8a Merge "[CTT-7] Delete the rules while half-closing tcp state entered" am: f7c8cec604
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755173

Change-Id: Ia2243c777d696e1f5bd94d8afd42d43ba1c1d48e
2021-07-13 12:17:54 +00:00
Nucca Chen
f22f935082 Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules" am: db30678605
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760692

Change-Id: Ie5b26c90bc7e7677259ce1be85ce55002cf03d2e
2021-07-13 12:17:48 +00:00
Nucca Chen
23e3eadde5 Merge "[CTT-5] Stop update TCP conntrack entry timeout" am: 69ccea4839
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760691

Change-Id: Ib1e1c1f2ccdf85bd3a7fd2275abb7ee144207b58
2021-07-13 12:17:43 +00:00
Nucca Chen
f7c8cec604 Merge "[CTT-7] Delete the rules while half-closing tcp state entered" 2021-07-13 12:07:12 +00:00
Nucca Chen
db30678605 Merge "[CTT-6] Update TCP conntrack entry timeout while adding rules" 2021-07-13 12:07:05 +00:00
Nucca Chen
69ccea4839 Merge "[CTT-5] Stop update TCP conntrack entry timeout" 2021-07-13 12:06:55 +00:00
Hungming Chen
118b5b578a [CTT-7] Delete the rules while half-closing tcp state entered
This is fixing post-FIN state (by disabling offload post-FIN).
Once the tcp state enters half-closing tcp state (fin wait,
close wait), delete the offload rules.

From this commit, we have done the short term solution for conntrack
tcp timeout issue. Here is what we have done so far.
- Stop updating tcp timeout to avoid updating wrong tcp state
  timeout.
- Update the ESTABLISHED timeout
  nf_conntrack_tcp_timeout_established (432000) after adding
  bidirectional rules.
- Delete the tcp rules when the tcp state has left
  "established".

Here is the long term solution and need to be addressed in follow up
commits.
- Parse the tcp state from netlink conntrack event.
- Build a mapping to trace the tcp state of the tcp conntrack event.
- Update tcp state timeout for {ESTABLISHED (432000), FIN_WAIT (120),
  CLOSE_WAIT (60)}.

Bug: 190783768
Bug: 192804833
Test: atest TetheringCoverageTests

Manual test:
1. Browse on tethered device
2. Check conntrack tcp state is established.
   $ cat /proc/net/nf_conntrack
   ipv4     2 tcp      6 431995 ESTABLISHED src=192.168.207.9
   dst=140.112.8.116 sport=50697 dport=443 ..
3. Check offload rules are added via dumpsys.
   Upstream:
     tcp .. 192.168.207.9:50697 -> 14(rmnet0) 10.224.1.247:50697
     -> 140.112.8.116:443 ..
   Downstream:
     tcp .. 140.112.8.116:443 -> 30(30) 10.224.1.247:50697
     -> 192.168.207.9:50697 ..
4. Stop browsing for a few seconds.
5. Check conntrack tcp state is half-closed.
   $ cat /proc/net/nf_conntrack
   ipv4     2 tcp      6 116 TIME_WAIT src=192.168.207.9
   dst=140.112.8.116 sport=50697 dport=443 ..
5. Check offload rules are removed via dumpsys.
   Upstream:
     (not found)
   Downstream:
     (not found)

Change-Id: I07e27230bf8952acd7828d1f605167758b3bc490
2021-07-13 14:28:58 +08:00
Hungming Chen
299a81157c [CTT-6] Update TCP conntrack entry timeout while adding rules
Needed because a payload data packet may have gone through
non-offload path, before we added offload rules, and that this
may result in in-kernel conntrack state being in ESTABLISHED
but pending ACK (ie. UNACKED) state. But the in-kernel conntrack
might never see the ACK because we just added offload rules.
As such after adding the rules we need to force the timeout back
to the normal ESTABLISHED timeout of 5 days.

Issue: the timeout is set to unacknowledged 300s (countdwon to 298s)
$ adb shell cat /proc/net/nf_conntrack
ipv4     2 tcp      6 298 ESTABLISHED src=192.168.244.128
dst=140.112.8.116 sport=45694 dport=443 ..

Test: atest TetheringCoverageTests
Manual check:
$ adb shell cat /proc/net/nf_conntrack
ipv4     2 tcp      6 431988 ESTABLISHED src=192.168.40.162
dst=140.112.8.116 sport=40774 dport=443 ..

Bug: 190783768
Bug: 192804833

Change-Id: I8c34e85e26c9d976e5e2b85473db75ff46d8abd4
2021-07-13 14:28:30 +08:00
Hungming Chen
a5c742be69 [CTT-5] Stop update TCP conntrack entry timeout
This is a preparation for only update the tcp timeout while
adding rules. Also add slack time for updating UDP timeout
interval.

Bug: 190783768
Bug: 192804833

Test: atest TetheringCoverageTests
Change-Id: I3151b531e6581e257f3cfa39ad2fcf1650358b3d
2021-07-13 14:26:58 +08:00
Remi NGUYEN VAN
b240e2a86e Jarjar all classes in service-connectivity
This ensures classes are used from the service-connectivity jar, instead
of using classes from the system_server bootclasspath when there is a
name conflict.
Any developer adding a future class should do so in a subpackage of
com.android.connectivity (such as com.android.connectivity.server).
Otherwise, jarjar rules need to be added manually until b/180995093 is
fixed.

Also update current jarjar rules so that classes are jarjared to
com.android.connectivity.[original name], making it easier to find the
original source. This is consistent with the wifi module.

Bug: 193086215
Test: atest CtsNetTestCases
      dexdump on service-connectivity.jar shows no classes outside of
      com.android.connectivity and com.android.server
Original-Change: https://android-review.googlesource.com/1759589
Merged-In: I2aadeca32751267b74d4fd2fd93bb3e8c62e46c0
Change-Id: I2aadeca32751267b74d4fd2fd93bb3e8c62e46c0
2021-07-13 04:42:07 +00:00
paulhu
07aa05e464 [automerger skipped] Update network preference priority value for VPN am: b5c9e3567f -s ours
am skip reason: Merged-In I197cb358e8e30355fbf675e4c623abebe7abdb7f with SHA-1 da7129d862 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15258458

Change-Id: Id0562b49fc90f3c3ad5ffde0deb06af8bfae7210
2021-07-13 03:29:45 +00:00
Maciej Żenczykowski
af3d38bea3 Merge "[CTT-4] Improve conntrack timeout update logging" am: 8d2e46aec3 am: ae7fb09d69
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760690

Change-Id: Ib662129472d947c75bf23598f2b64acbd9a67c8b
2021-07-13 02:45:06 +00:00
Maciej Żenczykowski
c5a6e13cfb Merge "[CTT-3] Add a string converter for TCP and UDP protocol number" am: 7d3d4eaca7 am: 9fd842569e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762187

Change-Id: I5e99d3070e5c2945fbef74ca49864e9a512910f0
2021-07-13 02:45:02 +00:00
Maciej Żenczykowski
303f4de48e Merge "[CTT-2] Clean up unused {function, exception} and improve readability" am: d6ca2420bb am: 45805fe7f0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762186

Change-Id: Ie62e21b5297a2da4ecde7f3527048ac987838105
2021-07-13 02:44:58 +00:00
Maciej Żenczykowski
954c8d383e Merge "[CTT-1] Rename conntrack related function, variable and constant" am: 2c2eccac73 am: d85fc83e41
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762185

Change-Id: Ie0b8eee8dd649432835ef89369d3ac2e6166d8da
2021-07-13 02:44:53 +00:00
Maciej Żenczykowski
ae7fb09d69 Merge "[CTT-4] Improve conntrack timeout update logging" am: 8d2e46aec3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760690

Change-Id: Ifdf2ef4dae1d295d9a27f04863efd136c4c5c808
2021-07-13 02:28:28 +00:00
Maciej Żenczykowski
9fd842569e Merge "[CTT-3] Add a string converter for TCP and UDP protocol number" am: 7d3d4eaca7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762187

Change-Id: I01167aa9e2754e7fd26054c62f49aa29f6201ffb
2021-07-13 02:28:23 +00:00
Maciej Żenczykowski
45805fe7f0 Merge "[CTT-2] Clean up unused {function, exception} and improve readability" am: d6ca2420bb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762186

Change-Id: Iebbf79ab6e45dbbc9f9523f40c54c1f501244d67
2021-07-13 02:28:18 +00:00
Maciej Żenczykowski
d85fc83e41 Merge "[CTT-1] Rename conntrack related function, variable and constant" am: 2c2eccac73
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762185

Change-Id: I9da178744d3a276ac3a26058eb5fd95240882beb
2021-07-13 02:28:12 +00:00
Maciej Żenczykowski
8d2e46aec3 Merge "[CTT-4] Improve conntrack timeout update logging" 2021-07-13 02:11:59 +00:00
Maciej Żenczykowski
7d3d4eaca7 Merge "[CTT-3] Add a string converter for TCP and UDP protocol number" 2021-07-13 02:10:09 +00:00
Maciej Żenczykowski
d6ca2420bb Merge "[CTT-2] Clean up unused {function, exception} and improve readability" 2021-07-13 02:09:36 +00:00
Maciej Żenczykowski
2c2eccac73 Merge "[CTT-1] Rename conntrack related function, variable and constant" 2021-07-13 02:09:00 +00:00
Remi NGUYEN VAN
bfb22a0a0a Merge "Jarjar all classes in service-connectivity" am: 23c627b090 am: 793a4424d7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1759589

Change-Id: I7a55b08af6efb311af1c5385b63a450e9c343fd7
2021-07-12 23:53:14 +00:00
Remi NGUYEN VAN
793a4424d7 Merge "Jarjar all classes in service-connectivity" am: 23c627b090
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1759589

Change-Id: I51c65720e00ab652daf8af51e74ace09347ece7d
2021-07-12 23:40:56 +00:00
Remi NGUYEN VAN
23c627b090 Merge "Jarjar all classes in service-connectivity" 2021-07-12 23:29:25 +00:00
paulhu
b5c9e3567f Update network preference priority value for VPN
Currently netd supports only the default value for VPN but CS
send priorty value 1 to netd. It will break the default routing
for VPN. Thus, update network preference priority value to 0 for
VPN.

Bug: 193245476
Test: atest CtsHostsideNetworkTests:HostsideVpnTests
Original-Change: https://android-review.googlesource.com/1762867
Merged-In: I197cb358e8e30355fbf675e4c623abebe7abdb7f
Change-Id: I197cb358e8e30355fbf675e4c623abebe7abdb7f
2021-07-12 16:02:38 +00:00
paulhu
525b37ccd0 Update network preference priority value for VPN am: da7129d862 am: 29797ebfae
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762867

Change-Id: I0065cc135f1988eaf8eff4d8c8696576ce7146a3
2021-07-12 15:14:59 +00:00
paulhu
29797ebfae Update network preference priority value for VPN am: da7129d862
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762867

Change-Id: I8aaea58aa38921cd354d326e074285f06d724f2b
2021-07-12 15:00:06 +00:00
Remi NGUYEN VAN
0755183fae Jarjar all classes in service-connectivity
This ensures classes are used from the service-connectivity jar, instead
of using classes from the system_server bootclasspath when there is a
name conflict.
Any developer adding a future class should do so in a subpackage of
com.android.connectivity (such as com.android.connectivity.server).
Otherwise, jarjar rules need to be added manually until b/180995093 is
fixed.

Also update current jarjar rules so that classes are jarjared to
com.android.connectivity.[original name], making it easier to find the
original source. This is consistent with the wifi module.

Bug: 193086215
Test: atest CtsNetTestCases
      dexdump on service-connectivity.jar shows no classes outside of
      com.android.connectivity and com.android.server
Change-Id: I2aadeca32751267b74d4fd2fd93bb3e8c62e46c0
2021-07-12 19:33:33 +09:00
paulhu
da7129d862 Update network preference priority value for VPN
Currently netd supports only the default value for VPN but CS
send priorty value 1 to netd. It will break the default routing
for VPN. Thus, update network preference priority value to 0 for
VPN.

Bug: 193245476
Test: atest CtsHostsideNetworkTests:HostsideVpnTests
Change-Id: I197cb358e8e30355fbf675e4c623abebe7abdb7f
2021-07-12 18:15:46 +08:00
Remi NGUYEN VAN
2cff18c9f5 Merge "Remove catch clause on compat shim" am: 5b37955322 am: 19122edbc5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760688

Change-Id: I962a30ce497292d4bc65d6724251d2a16a98d995
2021-07-12 04:19:04 +00:00
Remi NGUYEN VAN
19122edbc5 Merge "Remove catch clause on compat shim" am: 5b37955322
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760688

Change-Id: I9b3dea9ce41f0afb1093c9c0affb185e870c4cd3
2021-07-12 04:05:37 +00:00
Remi NGUYEN VAN
5b37955322 Merge "Remove catch clause on compat shim" 2021-07-12 03:52:54 +00:00
Remi NGUYEN VAN
92b099b4e7 Merge "Remove hidden ArrayUtils usage in test" am: 946da61e70 am: 3c5a0f7de9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760689

Change-Id: I9a96b7cbef135a86d13171cd5b1edfc69b68c2e0
2021-07-12 02:50:20 +00:00
Remi NGUYEN VAN
3c5a0f7de9 Merge "Remove hidden ArrayUtils usage in test" am: 946da61e70
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760689

Change-Id: If2a051f415f46544955e6646ed7d74c52d4e2d22
2021-07-12 02:31:43 +00:00
Remi NGUYEN VAN
946da61e70 Merge "Remove hidden ArrayUtils usage in test" 2021-07-12 02:21:12 +00:00
Hungming Chen
8d2bbd865a [CTT-4] Improve conntrack timeout update logging
Bug: 190783768
Bug: 192804833

Test: atest TetheringCoverageTests

Change-Id: I56792d75d12a0207e0a83a6d64e303f3bbfc3c6a
2021-07-11 15:06:22 +08:00
Hungming Chen
916ba672b7 [CTT-3] Add a string converter for TCP and UDP protocol number
Bug: 190783768
Bug: 192804833

Test: atest TetheringCoverageTests
Change-Id: I6a6452b65dd994fcf392e51917be52537a9d4cd9
2021-07-11 15:05:56 +08:00
Hungming Chen
71b85591ea [CTT-2] Clean up unused {function, exception} and improve readability
- Remove ipv4MappedAddressBytesToIpv4Address because it can be covered
  by parseIPv4Address.
- Remove IllegalArgumentException from parseIPv4Address because it has
  never happened
- Reverse the order of upstream and downstream timeout refreshing in
  refreshAllConntrackTimeouts for readability because both source and
  destination of the downstream are opposite direction to the
  upstream.

Bug: 190783768
Bug: 192804833
Test: atest TetheringCoverageTests
Change-Id: I6a1e44777a4357dd3847c2e2bb1fc6c3cf01617c
2021-07-11 15:05:39 +08:00
Hungming Chen
378bdbc2ef [CTT-1] Rename conntrack related function, variable and constant
Bug: 190783768
Bug: 192804833
Test: atest TetheringCoverageTests

Change-Id: Ib7ba480138b8aa8c6f8dffaa97787bac74a3972e
2021-07-11 15:04:37 +08:00
Remi NGUYEN VAN
7ae63c2f2a Merge "Rename shared utils to connectivity-module-utils" am: c5ba57ec15 am: bd514f4993
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757315

Change-Id: I253c86c016332aed02b480c54036e78fb3295bdb
2021-07-09 10:06:29 +00:00
Remi NGUYEN VAN
bd514f4993 Merge "Rename shared utils to connectivity-module-utils" am: c5ba57ec15
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757315

Change-Id: Ib72d1cf70e1d1842ba7563fb106fde3d30e9c4f6
2021-07-09 09:53:36 +00:00
Remi NGUYEN VAN
61cc1ac9bd Remove hidden ArrayUtils usage in test
Internal utils are generally jarjared by connectivity jarjar rules, but
ArrayUtils is not actually statically linked into the tests, so this
makes the ConnectivityCoverageTests fail. FrameworksNetTests has been
fine because it does not use jarjar, but does not exercise updated code
because of that.

Remove usage of the hidden utility, as there are reasonable alternatives
with non-hidden APIs that avoid other breakages long-term.

Bug: 187935317
Test: atest ConnectivityCoverageTests:ConnectivityServiceTest
Change-Id: I8ed85b941c3d1028771a5ac33196b1509a95789d
2021-07-09 18:52:51 +09:00
Remi NGUYEN VAN
c5ba57ec15 Merge "Rename shared utils to connectivity-module-utils" 2021-07-09 09:41:22 +00:00
James Mattis
07afe491d5 [automerger skipped] Only pass the NRI for removal in NRI#binderDied am: 4846fff84d -s ours
am skip reason: Merged-In I2a2ad4ec6d415423182a1856a898779203658f8b with SHA-1 8f03680fdb is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15236913

Change-Id: I8cb520b41a21529fb6afdcf5d62e4433c70f086e
2021-07-09 05:35:15 +00:00