Ignore stopping monitoring if the monitor has never started
for a given IpServer.
Also fix the related bug in
BpfCoordinator#testStartStopConntrackMonitoring.
Bug: 250552545
Test: atest BpfCoordinatorTest
Change-Id: I7ac71f0ed52bf52244aadaa3c90ca8df239873e4
Hungming Chenauthored and Nucca Chencommited 2022-10-03 11:56:38 +00:00
aosp/1536721 is merged, so this code duplication should not be needed any more.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic05adfc46495086d7f681322aac7acddc30a2260
Maciej Żenczykowskicommited 2022-09-16 06:35:32 +00:00
Currently, production code uses BpfMap type and TestBpfMap extends
BpfMap but this makes it diffcult to test because TestBpfMap loads the
JNI.
This CL updates to use IBpfMap type in the production code.
Upcoming CL updates TestBpfMap to implement IBpfMap instead of extending
BpfMap so that test can still use TestBpfMap but tests do not need to
load JNI.
Bug: 217624062
Test: atest BpfCoordinatorTest BpfNetMapsTest
Change-Id: Ie67e14bf5519fb4427474ecc0fda441877a9555f
There are three configuration could affect tethering allowed:
1. user restriction
2. tether_supported settings
3. ro.tether.denied system properties
When user restricted or tether supported setting change, updating
supported downstreams.
ro.tether.denied is read only properties, so it won't be changed runtime.
Also correct the unit test that there is no TetheringConfiguration change when settings or user restriction change.
Bug: 184996041
Bug: 239500515
Test: atest TetheringTests
Change-Id: I8dfcc42de9787a5e9ba19b69db9444c14ace56f0
Also just use 'int' for ifindex. The kernel allocates these in order,
if we ever exceed 2 billion, we'll have other problems to worry about.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I33eb46185fde90cd4d158bb74f8f9c17b41434fb
Maciej Żenczykowskicommited 2022-08-18 01:07:20 +00:00
These are allocated in order by the kernel, if we go
over 2 billion, we've got other problems... besides
U32 to S32 conversion will work just fine anyway.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ifbb7139e9118dd2d0c52e83c5874132e03760b30
Maciej Żenczykowskicommited 2022-08-18 01:07:11 +00:00
* changes:
BpfCoordinator: dump IPv6 BPF downstream rules
BpfCoordinator: change function name and format for dumping IPv6 rules
add header on ipv6 forwarding rulesdump
add header on ipv6 upstream bpf map dump
Maciej Żenczykowskiauthored and Gerrit Code Reviewcommited 2022-08-18 00:49:54 +00:00
Used for test interface upstream can replace existing non-test
upstream interface, like ethernet on cuttlefish.
This helps to fix the flaky test when we are using test interface on
cuttlefish. Because the ethernet and test interface upstream update
event order can't be guaranteed.
Bug: 237369591
Bug: 242067530
Test: atest ConnectivityCoverageTests
Change-Id: I9da71ee116bf1ebc9831f61f25acf42e328a8370
The forwarding pairs may use the same downstream. Ex: 464xlat
tethering has rmnet0:ncm0, v4-rmnet0:ncm0 forwarding pairs.
Need to avoid duplicate downstream program.
Bug: 241106456
Test: atest BpfCoordinatorTest
Change-Id: Ic41b3ad856e4876808f8497a760081afcfd04988
To backward compatible existing behavior, make tethering APIs
unsupported synchronously when tethering is disallowed. There
are two APIs register/unregisterTetheringEventCallback still
supported even tethering is disallowed.
This could avoid some existing tests flaky. The test assume
startTethering would fail right away after tethering restricted
apply.
Bug: 184996041
Bug: 239500515
Test: atest TetheringTests
Change-Id: I41ae1d61647c9baf69bcb246965e8d9b4a89b497
When enable/disable tethering quickly, tethering may have stopped
when Ipserver start creatFd().
As tethering iface is down due to tethering stopped, creatFd() will
throw ErrnoException: bind failed: ENODEV (No such device).
When tethering is stopped, this exception is normal, should not
rise WTF.
Bug: 233587050
Test: manual test
Change-Id: I2e200313d1bec2c1e1245e779f3875397127160d
zhengyu.zhanauthored and Lili Lincommited 2022-07-19 17:18:26 +08:00
"{@see" aren't rendered properly. Replace them with "See {@link"
or @see depending on the usage.
Bug: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I70cb2f36e7c5fa8102b5949054df5184d755202c
tethering-module-utils-srcs filegroup only contains NetdUtils.java
class, import this class from netd-client static lib instead.
Bug: 238960524
Test: m
Change-Id: I7547c3a3a13e564408cdf8e702f3438530763381
NetworkStack module utils are duplicated to net-utils-device-common-ip,
delete the module utils source code and use net-utils-device-common-ip
instead.
Bug: 235901424
Test: atest TetheringTests
Change-Id: I19fe72a92d6de1084963c2b3a38d094f8da2a91e
There is a bug in TetheringMetrics that the on-going builders would be
cleared when creating new builder. This means if multiple tethering
created at the same time, only latest tethering would have metrics.
Bug: 153942334
Test: atest TetheringTests
Change-Id: I16a66790bc19072d8ffe570348bcbafa91263573
Markauthored and Mark Chiencommited 2022-06-28 10:31:02 +00:00
changeInterfaceState only used in enableIpServing which always
pass STATE_TETHERED or STATE_LOCAL_ONLY state. Move it into
enableIpServing directly and remove unused code.
Test: m
Change-Id: I2d91115e588a153ddcb9d61f8e2bc09a09c52d48
Markauthored and Mark Chiencommited 2022-06-28 06:46:27 +00:00
Move base64 related bpf map function and constant to f/l/n.
This is preparation for testing BPF map in ClatCoordinator.
Test: atest EthernetTetheringTest
Change-Id: Ieb1e0a0f128c9aa0d7c9f043e90eecf3c61252f5
This is a preparing change.
1) In enableWifiIpServing, replace
ensureIpServerStarted(ifname) +
changeInterfaceState(ifname, ipServingMode)
with enableIpServing(TETHERING_WIFI, ifname, ipServingMode).
And checking whether corresponding wifi or p2p feature is
avaialble before enableWifiIpServing. Note: If the wifi or p2p
feature wasn't supported before, it would still call
changeInterfaceState without ipServer created but
changeInterfaceState would be no-op because there is no
corresponding ipServer for changing state.
2) Splitting enableWifiIpServing into enableWifiIpServing and
enableWifiP2pIpServing.
3) No longer guess the interface name after T. WIFI_AP_STATE_CHANGED
intent should always include ifname and it should be tracked by
mTetherStates. If OEM have modification in wifi framework to send
empty ifname, tethering no longer support this after T.
4) After T, tethering always trust the ifname which pass by wifi or p2p
intent broadcast and treat it as TETHERING_WIFI or
TETHERING_WIFI_P2P. This allow tethering to deprecate wifi/p2p regexs
after T.
Bug: 189410000
Bug: 178116595
Bug: 185451791
Bug: 190145323
Bug: 176048959
Test: atest TetheringTests
Change-Id: Ia5f69ddf2d842536ce0df75eeae57866f56df571
Before T, wifi local only mode won't update onConnectedClientsChanged.
To support updating tethered client information for localOnly hotspot,
register localOnly softap callback to get connected wifi client update.
Bug: 171928468
Test: atest TetheringTests
Change-Id: I0e974feea9497809ea02a4138c7b9c2c584a8a45
Fill in downstream type, upstream type, error code and user type to NetworkTetheringReported.
Bug: 153942334
Test: m, flash and boot
Test: atest TetheringMetricsTest
Change-Id: I6ba7d9e512b1ada519f44f9f3a95667e4b0f03c0
Make that tethering dumpsys can choose which map to dump.
The related functions in BpfCoordinator and its test are refactored
into template functions. This is used in the following commits which
will dump stats map for testing.
Bug: 227159997
Test: atest TetheringCoverageTests
Change-Id: I23d747543d16a971773c132b60227eb3f42efe25