Commit Graph

753 Commits

Author SHA1 Message Date
Junyu Lai
108d20f84a [MS81] Support remove history before cutoff timestamp
This is needed to ensure corrupted data can be clean up if
the data migration process dones't go well.

Test: NetworkStatsCollectionTest
Bug: 197717846
Change-Id: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c
(cherry picked from commit 306a00316c)
Merged-In: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c
2022-05-16 05:53:02 +00:00
Chiachang
bc65e7e992 Address leftover comments
This is a follow-up commit from aosp/2076483. Mainly to update:
1. Update the hex string to human understandable code instead of
   byte code.
2. Use IgnoreUpTo() to do the SDK check
3. Avoid relying on the code being tested

Bug: 192078259
Test: atest FrameworksNetTests
Change-Id: I8973d248a1d30fdcb597677dbf051e146041f905
(cherry picked from commit a023f88193)
Merged-In: I8973d248a1d30fdcb597677dbf051e146041f905
2022-05-13 03:01:50 +00:00
chiachangwang
f2897b8a93 Test [set|get]AppExclusionList
Bug: 192078259
Test: atest FrameworksNetTests
Change-Id: Iee81d84b4127420121ce2d5a7defc3dbe34b6cde
(cherry picked from commit 218d5652de)
Merged-In: Iee81d84b4127420121ce2d5a7defc3dbe34b6cde
2022-05-13 02:47:56 +00:00
Martijn Coenen
c0cf5a9bac Modify VPN unit tests to include SDK sandbox UIDs.
VPN configurations in T should automatically include the corresponding
SDK sandbox UID of an application.

The existing tests used a UID range outside the regular application
range, which means the new sandbox UIDs wouldn't be tested. Modified the
UIDs to run in the regular UID range of [10000, 19999]. Changed the
tests to include the SDK sandbox UID where necessary.

Also, changed the entire class to only run on T+, since that is the only
place where the SDK sandbox UIDs will be added. Since VPN code is not
mainline updatable, having coverage on earlier releases doesn't really
help anyway.

Finally, fixed up testNetworkBlockedStatusAlwaysOnVpn() in
ConnectivityServiceTest, and only have that run on T+ for the same
reasons.

Bug: 225317905
Test: atest VpnTest
Test: atest ConnectivityServiceTest

Change-Id: I83009344c270e520ac8ad1558c067cf7e46b1d2e
Merged-In: I83009344c270e520ac8ad1558c067cf7e46b1d2e
2022-05-12 12:11:45 +00:00
Paul Hu
2edf88960a Merge changes from topic "cherrypicker-L53700000954454916:N44100001263878999" into tm-dev
* changes:
  Check carrier privilege for CBS network requests synchronously
  Allow 3p apps to request restricted networks
2022-05-12 02:48:34 +00:00
Sooraj Sasindran
d359d19813 Fallback should be evaluated for each preference
1) alowFallback flag was incorrectly not reset while setting profile
   preference. Corrected it.

2) Threw exception if default preference and enterprise preference are
set together

3) renamed clearUser to withoutUser

Bug: 231670730
Test: ConnectivityServiceTest

Change-Id: If92ebe0cc23f18c8808893926d5e1d12ff2e3650
Merged-In: Iaf49237bdc791c7e1dd884d069eff64e74757477
2022-05-11 23:56:48 +00:00
junyulai
f9fc36ea3a Check carrier privilege for CBS network requests synchronously
Normally if an app calls requestNetwork with capabilities that it
does not have permission to request, it gets a SecurityException,
except if it requests NET_CAPABILITY_CBS, in which case the request
will not throw but the app will get an onUnavailable callback.

Make this codepath throw as well. This simplifies the code and makes
the app-visible behaviour more consistent (and consistent with what
happens in S and below). The reason the code was written this way is because the carrier privilege app should receive a callback if it
loses permission. But onUnavailable is also not the best callback to
send, since it is used very rarely and also releases the app's
request. It seems better to leave the request registered and send
onLost.

Test: atest FrameworksNetTests
Bug: 194332512
Change-Id: I5eaeb415a6654851246e38599a996fbd9366fde0
(cherry picked from commit 96bd9fe4de)
Merged-In: I5eaeb415a6654851246e38599a996fbd9366fde0
2022-05-11 13:50:06 +00:00
Junyu Lai
4c14d7a94d Improve logging for NetworkStatsObservers
In order to have better logging to gather information
about the callers. This change includes:
 1. Add pid and package name into RequestInfo for better logging.
 2. Print current observers in dumpsys section.
 3. Enable register/unregister usage request logging by default.

The log added in the dumpsys section looks like:
Stats Observers:
  RequestInfo from pid/uid:2001/1000(android) for DataUsageRequest [...] accessLevel:3
  ...

Test: NetworkStatsObserversTest
Bug: 229103088
Change-Id: Ide68776dc279610e8dee0efd924b59a1fac2b7b6
(cherry picked from commit c259e615e6)
Merged-In: Ide68776dc279610e8dee0efd924b59a1fac2b7b6
2022-05-10 10:56:44 +08:00
Sooraj Sasindran
ca9e8fe1c9 Do not remove profile network preference for different uids
Multiple enterprise slice can be setup within single user profile based
on different uids. So do not remove profile network preference with same
user profile but with different uids

Bug: 229644102
Test: manual system test and ConnectivityServciceTest
Change-Id: I897b643e01240958fff575de9e15182069efc698
(cherry picked from commit 9cc129f37d)
Merged-In: I897b643e01240958fff575de9e15182069efc698
2022-05-09 09:44:35 +00:00
Sooraj Sasindran
38b5ce570c Add more tests for setProfileNetworkPreferences
1. Test that adding a new preference replaces the existing preference.
2. Test that if we pass in two simultaneous preferences for the same user.
   (e.g., two different groups of apps), the second overrides the first.

Bug: 229644102
Test: ConnectivityServciceTest
Change-Id: I819247711f8457b12792585216ff47be31457ae8
(cherry picked from commit 95e02c5d5a)
Merged-In: I819247711f8457b12792585216ff47be31457ae8
2022-05-09 09:44:33 +00:00
Vadim Caen
77abf9b3c1 Follow-up 2076940: Allow device owner to configure profile network preference
https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2076940

Fixes build failure

Bug: 231104107
Bug: 226966328
Bug: 231071836
Test: tests/unit/java/com/android/server/ConnectivityServiceTest.java
Change-Id: I7b6a3880ce0b0b9ad6fc6aa7a5fd4e249bb1606d
(cherry picked from commit baade1ca1e)
Merged-In: I7b6a3880ce0b0b9ad6fc6aa7a5fd4e249bb1606d
2022-05-05 16:47:33 +00:00
Sooraj Sasindran
f7b4c451ce Allow device owner to configure profile network preference
isMangedProfile returns true for managed profiles.
But enterprise device can be fully managed like device owner.
Hence check specifically if request is coming on fully managed
device.

Bug: 226966328
Bug: 231071836

Test: ran DevicePolicyManager CTS and ConnectivityServiceTest
Change-Id: I7827466bd61e24ba9c36c3a2e25043257e2ed602
(cherry picked from commit bb65aa8fc2)
Merged-In: I7827466bd61e24ba9c36c3a2e25043257e2ed602
2022-05-04 06:19:28 +00:00
Chiachang Wang
fe35305b32 Merge "Test Ikev2VpnProfile provisioned with IkeTunnelConnectionParams" am: 2e670756ac am: 9942af20c0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2063922

Change-Id: I966e6dac28759075313774966039097ff033d686
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-25 09:31:52 +00:00
Chiachang Wang
2e670756ac Merge "Test Ikev2VpnProfile provisioned with IkeTunnelConnectionParams" 2022-04-25 08:44:45 +00:00
Maciej Żenczykowski
4249b8be1d adjust for new T bpfloader net_shared location am: 0736d7bd91 am: 96706b661f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2071008

Change-Id: Iba57cbfe6f3c41fc7c396098f0caa662d68b1e0e
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-23 09:56:33 +00:00
Maciej Żenczykowski
0736d7bd91 adjust for new T bpfloader net_shared location
(this is safe because on pre-T none of these maps and programs are mainlined
 and thus safe to access from mainline code anyway)

Test: TreeHugger, manual
Bug: 218408035
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I23e565d665247f33e084978890a1ee8ffe0fe568
2022-04-23 09:03:06 +00:00
Maciej Żenczykowski
2fadc5413c Merge "[CLATJ#27] Use ClatdCoordinator since T+ devices" am: b4bf6cea38 am: 8d75a93995
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1951099

Change-Id: I3878e5359349d8195e8741ea69ae437edab68909
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-21 14:34:12 +00:00
chiachangwang
476e2a08bf Test Ikev2VpnProfile provisioned with IkeTunnelConnectionParams
Bug: 223841137
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I683f6242e4ed4a469893e3a17fe7b479a7a768e5
2022-04-21 14:49:41 +08:00
Hungming Chen
eb15a2d816 [CLATJ#27] Use ClatdCoordinator since T+ devices
- For clatd start and stop, use ClatdCoordinator on T+ and Netd on S-
- Fix the unit test for T+ and S- devices
  Note that mokito.verify(.., times(1)) is replaced by verify(..)
  because times(1) is the default and can be omitted.
  See verify in mockito/src/main/java/org/mockito/Mockito.java

Note that this commit needs to be merged with aosp/1956072.

Bug: 212345928
Test: atest FrameworksNetTests
      manual test
      1. Connect to ipv6-only wifi.
      2. Try IPv4 traffic.
         $ ping 8.8.8.8
      3. Check bpf entries are added
      4. Disconnect from ipv6-only wifi.
      5. Check bpf entries are removed
      6. testipv4.com shows 10/10

Change-Id: I7dfda6eec19de94e4258971effcd8a1210542473
2022-04-21 13:24:36 +08:00
Aaron Huang
d79f543df0 Merge "Fix NullPointerException happens in dumpCheckin" am: 6b7e457988 am: 44a02af11a am: a4d60dd2ad
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2059628

Change-Id: If9933b6aad05abf79e85f9172ba6eb6f8492d648
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 06:12:50 +00:00
markchien
28160b3141 Fix permission bypass problem for Tethering deprecated APIs
Since the tethering functions in ConnectivityService is delegated
to TetheringManager instance and get caches informataion in
TetheringManager without checking ACCESS_NETWORK_STATE permission.
If application use reflection call getTetherXXX functions in
ConnectivityService, it can get tethering status with no additional
execution privileges needed.

Bug: 162952629
Test: manual
Ignore-AOSP-First: security fix
Change-Id: I5b897f216db19fead6ba6ac07915aa0f6ff5bf42
2022-04-19 19:13:10 +08:00
Aaron Huang
c3a43b4063 Fix NullPointerException happens in dumpCheckin
Currently dumpCheckin passes a null object to create
the contructor of NetworkStatsCollection.Key but the
constructor requires non-null object. Thus, it caused
the NPE in dumpCheckin. To fix this exception, create
an NetworkIdentitySet() object instead of using an
null object.

Bug: 225131008
Bug: 226539404
Test: dumpsys netstats --checkin is fine
      FrameworksNetTests
Change-Id: I7f2dadf0647b3f42e0f667d96291d2ae37e23faf
2022-04-19 17:49:30 +08:00
Natasha Lee
e765e2fbc0 Merge "Save appIds permissions for each user" am: 7f85379b07 am: 54a472764a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2052545

Change-Id: I0fdfcb45c508ae01b87471b1716442755cd76fb0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-13 00:59:49 +00:00
Natasha Lee
7f85379b07 Merge "Save appIds permissions for each user" 2022-04-12 23:55:06 +00:00
paulhu
a501e47e19 Save appIds permissions for each user
PermissionMonitor does not store any information regarding
traffic permission. It just checks permission from each package
and sends the result to netd. In addition, bpf can store traffic
permissions for appIds only because of memory limitations.

However, there is a mistaken permission overwriting when
different packages are installed on multi-user. Because
PermissionMonitor updates appIds traffic permissions to netd
from each user, so the permission result will depend on the
latest user state.

To fix the problem, save the traffic permissions by each user and
appId on PermissionMonitor. An appId has a permission if and
only if at least one uid in that appId has that permission.

bug: 224775316
Test: atest FrameworksNetTests CtsNetTestCases \
      CtsNetTestCasesUpdateStatsPermission \
      CtsNetTestCasesInternetPermission
Change-Id: Ieb01fb21f6201a58723eb7e6446b127627be2c0e
2022-04-12 11:06:46 +00:00
Paul Hu
104c01390a Merge "Remove NativeDaemonConnector relevant files" am: 631c2387a6 am: 4eaeac9baa
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2059332

Change-Id: If12e2a9dff214da5541d4002b33d313898aa2b18
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-12 08:16:33 +00:00
Paul Hu
631c2387a6 Merge "Remove NativeDaemonConnector relevant files" 2022-04-12 07:37:16 +00:00
paulhu
cee953bd09 Remove NativeDaemonConnector relevant files
NsdService is using binder call to communicate with
mdnsresponder, so there is no one to use NativeDaemonConnector
now. Thus, remove NativeDaemonConnector relevant files.

Bug: 209894875
Test: atest FrameworksNetTests
Change-Id: Ic70d9417dc85c04c537e09d8f8586a762ac9a97b
2022-04-12 07:35:31 +00:00
Maciej Żenczykowski
c0b2a55ae3 Merge changes I2c3242f8,Iaa67d5ae am: b3bf5fedab am: f23da94516
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2050859

Change-Id: I6f851d52045a9539eb2300d137e5f80e56c44412
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-11 21:26:10 +00:00
Maciej Żenczykowski
87463ab17e Merge "ClatCoordinator: use Java class TcUtils to attach program" am: 932459748a am: 77487413aa
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2028287

Change-Id: I652d8f315fc4e8193bdddd22387426bb8e6af6bb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-11 21:26:01 +00:00
Maciej Żenczykowski
4f58c8c456 Merge changes from topic "access_clat_bpf_map_from_clatcoordinator" am: 7b75c07cda am: b8a2781ad7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2024483

Change-Id: I0da79e64472816b2a0e5da7e76691f77a28abe03
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-11 21:25:52 +00:00
Maciej Żenczykowski
b3bf5fedab Merge changes I2c3242f8,Iaa67d5ae
* changes:
  Remove unused TcUtils{, Test}, bpfhelper from libclat
  ClatCoordinator: use Java class TcUtils to detach program
2022-04-11 20:47:50 +00:00
Maciej Żenczykowski
932459748a Merge "ClatCoordinator: use Java class TcUtils to attach program" 2022-04-11 20:47:26 +00:00
Maciej Żenczykowski
7b75c07cda Merge changes from topic "access_clat_bpf_map_from_clatcoordinator"
* changes:
  ClatCoordinator: use Java class BpfMap to remove clat rule
  ClatCoordinator: use Java class BpfMap to add clat rule
2022-04-11 20:46:59 +00:00
Patrick Rohr
b22f1369c9 Merge "Use completeExceptionally instead of second future" am: da294fc886 am: 2f4ad45851
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2054246

Change-Id: I2a6e05de781ab69b667fa8b94c686f0aedd9153f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-07 12:50:47 +00:00
Patrick Rohr
da294fc886 Merge "Use completeExceptionally instead of second future" 2022-04-07 12:12:32 +00:00
Chiachang Wang
5e16c68d00 Merge "Update test for new IkeTunnelConnectionParams field" am: 5850372963 am: 73242c8a0e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1976972

Change-Id: I25cd0a8614b8b1c400026f655b34b67fd5116e3e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-07 11:37:31 +00:00
Chiachang Wang
5850372963 Merge "Update test for new IkeTunnelConnectionParams field" 2022-04-07 10:24:03 +00:00
Paul Hu
ac780d3bd0 Merge changes from topic "MDns_AIDL" am: 09475308b7 am: 06e59627bb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2049246

Change-Id: I16b7ec71fbfee1dd0de84b1f64d5e9fbbd62f4e3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-07 03:10:55 +00:00
Paul Hu
09475308b7 Merge changes from topic "MDns_AIDL"
* changes:
  Use MDns aidl on NsdService
  Add MDnsManager
2022-04-07 02:06:35 +00:00
paulhu
2b9ed95ae5 Use MDns aidl on NsdService
- Use MDns aidl to communicate with mdns service and register
  event listener to receive callback.
- Remove all NDC relevant code on NsdService.
- Use MDns aidl on NsdServiceTest.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I65929dee3838fef753396e86c665abd66b6fec81
2022-04-04 15:18:27 +00:00
Patrick Rohr
fd87fb65fb Use completeExceptionally instead of second future
The onError callback can use the same future as the onResult callback by
calling completeExceptionally.
This change is also removing the test for a specific exception message.
Testing for a specific exception message would mean that tests break if we
ever were to update them. If we decide that there is value to
distinguish between different types of
EthernetNetworkManagementException we should probably subclass it
internally.

Test: atest EthernetNetworkFactoryTest
Change-Id: Ib6f8cf79fc26e0f856c880cbe505b101f12aa187
2022-04-04 14:59:42 +02:00
Remi NGUYEN VAN
9dcc6c676d Merge changes Id533cdb4,I6a9ce3d6,I345bf073 into sc-mainline-prod am: c3315f2560
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/17530925

Change-Id: I9e1375f47ab85db92cf602f0be63bac0160aab78
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 08:29:40 +00:00
Remi NGUYEN VAN
40da62da48 Merge EthernetServiceTests into FrameworksNetTests
As per the TODO, merge EthernetServiceTests into the larger
FrameworksNetTests suite.

Similarly to NetworkStats, NSD or IpSec tests, the tests are also marked
as "non-connectivity-module-test", where "module" actually refers to
modules being built for release (from an S-based branch) today. This is
necessary as the tests and associated code cannot build without T APIs.

Also add FrameworksNetTests to presubmit as non-connectivity-module
tests are not run in presubmit without this.

Test: TH
Merged-In: Id533cdb4ac184b963f570af299dea04754ba88e9
Change-Id: I9950fcb49fdc2217134a59e993941cbe5da0b556
2022-04-01 15:12:18 +09:00
Remi NGUYEN VAN
6ad9287432 Merge EthernetServiceTests into FrameworksNetTests
As per the TODO, merge EthernetServiceTests into the larger
FrameworksNetTests suite.

Similarly to NetworkStats, NSD or IpSec tests, the tests are also marked
as "non-connectivity-module-test", where "module" actually refers to
modules being built for release (from an S-based branch) today. This is
necessary as the tests and associated code cannot build without T APIs.

Also add FrameworksNetTests to presubmit as non-connectivity-module
tests are not run in presubmit without this.

Test: TH
Ignore-AOSP-First: Merged in topic, will be cherry-picked
Change-Id: Id533cdb4ac184b963f570af299dea04754ba88e9
2022-04-01 15:08:48 +09:00
Hungming Chen
3dc0577ed3 ClatCoordinator: use Java class TcUtils to attach program
This a preparation to replace duplicated native functions with the
existing Java class.

Bug: 221213090
Test: atest FrameworksNetTests
Test: manual test
Steps:
1. Connect to IPv6-only wifi
2. Check tc filter on wlan0 and v4-wlan0

$ adb shell tc filter show dev wlan0 ingress
filter protocol ipv6 pref 4 bpf chain 0
filter protocol ipv6 pref 4 bpf chain 0 handle 0x1 prog_clatd_schedcls_ingress6_clat_ether:[*fsobj] direct-action not_in_hw id 23 tag 40918e0675598c8d

$ adb shell tc filter show dev v4-wlan0 egress
filter protocol ip pref 4 bpf chain 0
filter protocol ip pref 4 bpf chain 0 handle 0x1 prog_clatd_schedcls_egress4_clat_rawip:[*fsobj] direct-action not_in_hw id 26 tag 5d0057eab14480b7

$ adb shell tc filter show dev wlan0 egress
(empty)

$ adb shell tc filter show dev v4-wlan0 ingress
(empty)

Change-Id: Id4edbfd87de8f9c5d2fa483b2024718b484cb044
2022-03-31 16:04:42 +08:00
Hungming Chen
bd85f8903e ClatCoordinator: use Java class BpfMap to remove clat rule
This a preparation to replace duplicated native functions with the
existing Java class.

Bug: 221213090
Test: atest FrameworksNetTests
Test: manual check

Steps:
1. Connect wlan and check map content {iface index, v4addr, v6addr, pfx96} manually
after clat started.
$ adb shell dumpsys netd
  ClatdController
    BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
      47(wlan0) 64:ff9b::/96 2a00:79e1:abc:6f02:2479:2f51:25a9:28f1 -> 192.0.0.4 53(v4-wlan0)
    BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)
      53(v4-wlan0) 192.0.0.4 -> 2a00:79e1:abc:6f02:2479:2f51:25a9:28f1 64:ff9b::/96 47(wlan0) ether

2. Disconnect wlan and check the bpf map is removed.
$ adb shell dumpsys netd
  ClatdController
    BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
    BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)

Change-Id: Ia0c90c7104c4a42d34a28a5ddf3cf13a289f8c76
2022-03-31 16:04:42 +08:00
Hungming Chen
cddd855f9e ClatCoordinator: use Java class TcUtils to detach program
This a preparation to replace duplicated native functions with the
existing Java class.

Bug: 221213090
Test: atest FrameworksNetTests
Test: manual test
Steps:
1. Connect to IPv6-only wifi

2. Check tc filter on wlan0 and v4-wlan0

$ adb shell tc filter show dev wlan0 ingress
filter protocol ipv6 pref 4 bpf chain 0
filter protocol ipv6 pref 4 bpf chain 0 handle 0x1 prog_clatd_schedcls_ingress6_clat_ether:[*fsobj] direct-action not_in_hw id 23 tag 40918e0675598c8d

$ adb shell tc filter show dev v4-wlan0 egress
filter protocol ip pref 4 bpf chain 0
filter protocol ip pref 4 bpf chain 0 handle 0x1 prog_clatd_schedcls_egress4_clat_rawip:[*fsobj] direct-action not_in_hw id 26 tag 5d0057eab14480b7

$ adb shell tc filter show dev wlan0 egress
(empty)

$ adb shell tc filter show dev v4-wlan0 ingress
(empty)

3. Disconnect from wifi

4. Check tc filter on wlan0 and v4-wlan0

$ adb shell tc filter show dev wlan0 ingress
(empty)

$ adb shell tc filter show dev v4-wlan0 egress
(empty)

$ adb shell tc filter show dev wlan0 egress
(empty)

$ adb shell tc filter show dev v4-wlan0 ingress
(empty)

Change-Id: Iaa67d5ae7c867d791d5f92a70a54bf549085053a
2022-03-31 16:04:42 +08:00
Hungming Chen
07fcf9ca49 ClatCoordinator: use Java class BpfMap to add clat rule
This a preparation to replace duplicated native functions with the
existing Java class.

Bug: 221213090
Test: atest FrameworksNetTests
Test: check map content {iface index, v4addr, v6addr, pfx96} manually.
The map fileds are the same as "ip addr" and clatd logging.

$ adb shell dumpsys netd
ClatdController
  BPF ingress map: iif(iface) nat64Prefix v6Addr -> v4Addr oif(iface)
    47(wlan0) 64:ff9b::/96 2a00:79e1:abc:6f02:f9e1:8c2d:604e:bc06 -> 192.0.0.4 53(v4-wlan0)
  BPF egress map: iif(iface) v4Addr -> v6Addr nat64Prefix oif(iface)
    53(v4-wlan0) 192.0.0.4 -> 2a00:79e1:abc:6f02:f9e1:8c2d:604e:bc06 64:ff9b::/96 47(wlan0) ether

$ adb shell ip addr
47: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ..
53: v4-wlan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1472 ..

03-14 18:35:04.822 30852 30852 I clatd   : Starting clat version 1.5 on wlan0 plat=64:ff9b:: v4=192.0.0.4 v6=2a00:79e1:abc:6f02:f9e1:8c2d:604e:bc06

Change-Id: I91d0cb6e76c4ef7bacf91b996786308ff4918f35
2022-03-31 15:53:33 +08:00
Chiachang Wang
69aa988090 Update test for new IkeTunnelConnectionParams field
Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: Iab55eba74b94f295a358c6e8474ebf9230c9b019
2022-03-31 14:45:59 +08:00