Skip to content
Snippets Groups Projects
  1. Feb 21, 2024
  2. Jan 31, 2024
  3. Jan 24, 2024
  4. Jan 23, 2024
    • Mark's avatar
      Add experiment flag for enabling sync sm · c512ab7e
      Mark authored
      The logic is currently disabled by default, adding a flag so
      that we can compare result with A/B rollout. Tethering only read
      this flag once when it is created.
      
      Bug: 319212113
      Test: atest TetheringTests
      
      Change-Id: I656b0389e56d29dd691738ee3abfa6418746846f
      c512ab7e
  5. Jan 22, 2024
  6. Jan 10, 2024
    • Junyu Lai's avatar
      Migrate Tethering#dump to use runWithScissorsForDump · 2ff42d26
      Junyu Lai authored
      This change includes:
        1. Refactor the logic in Tethering#dump into utils class.
        2. Move the utils class to a common place which could be referenced
           from other sub-modules.
        3. Add @MonitorThreadLeak annotation to enforce
           there is no thread leak problem.
      
      Test: atest FrameworksNetTests NetworkStaticLibTests
      Test: atest ConnectivityCoverageTests:com.android.networkstack.tethering.TetheringTest#testDumpTetheringLog
      Test: adb shell dumpsys tethering (with hardcoded exception)
      Fix: 312669345
      
      Change-Id: Ia6fdfeeec2110afa0ec9e056e9db3843748845c3
      2ff42d26
  7. Dec 27, 2023
    • Mark's avatar
      Start Ethernet tethering test once before testing · 2d0652a4
      Mark authored
      The first tethering test case might have a tethering restart when
      handling IP conflicts. Currently, we start a hotspot once before
      tethering, but the test is still flaky in Cuttlefish because it
      doesn't support hotspots. Instead, we'll start ethernet tethering.
      
      Bug: 254183718
      Test: atest CtsTetheringTest
      Change-Id: I695d4e1b3f961893bc30b3144faf7ad7d2d70574
      2d0652a4
    • Mark's avatar
      Make isInterfaceForTetheringAvailable and enableEthernetTethering static · 28b3ea4e
      Mark authored
      Bug: 254183718
      Test: atest CtsTetheringTest
      Change-Id: Ie8bf908fc926a0b8b58559c8827951cbeaedc2c6
      28b3ea4e
    • Mark's avatar
      EthernetTetheringTest: make some global variables static · 1e6e2720
      Mark authored
      Before making enableEthernetTethering a static function, make its
      dependency variable static.
      
      Bug: 254183718
      Test: atest CtsTetheringTest
      Change-Id: Id3781d67b3abc69b146fa704d4795bcfb2431a2a
      1e6e2720
  8. Dec 12, 2023
    • Mark's avatar
      Add experiment flag for tethering refactor · cf11be9e
      Mark authored
      The logic is currently disabled by default, adding a flag so
      that we can compare result with A/B rollout.
      
      Test: atest TetheringTests
      Change-Id: If640b9a172b97aa67c49b2976cdef118218f1e0f
      cf11be9e
  9. Dec 08, 2023
  10. Dec 04, 2023
    • Mark's avatar
      Rename getXXX to makeXXX in TetheringDependencies · b720d6d7
      Mark authored
      This fix the code review comment from aosp/2319853 that getXXX functions
      should be renamed to makeXXX because it's actually creating the object.
      
      Test: TH
      Change-Id: Ife8e1cc3a90b835764a2dd9731388b05d8a5c964
      b720d6d7
  11. Nov 28, 2023
    • Mark's avatar
      Random select started prefix range · c0b0f616
      Mark authored
      Currently, PrivateAddressCoordinator always selects the /24 prefix
      from the 192.168.x.x/16 range first. If the upstream is also a /24
      prefix in the 192.168.x.x/16 range, there's a 1/256 chance of a
      conflict (192.168.0.x/24 ~ 192.168.255.x/24). Since 192.168.x.x/16
      is a popular range for home and small business networks, we should
      randomize the starting prefix range to reduce the chance of a
      conflict. The /8, /12, and /16 range selection rates are 0.39%,
      5.86%, and 93.7%, respectively (see the inline comments for how
      the rates are calculated).
      
      The chance of selecting a /24 prefix is:
      - 10.0.0.0/8: 1/(256*256) * 93.7% = 0.001429%
      - 172.16.0.0/12: 1/(16*256) * 5.86% = 0.00143%
      - 192.168.0.0/16: 1/256 * 0.39% = 0.001523%
      
      Note: This change is currently turned off by the
      tether_force_random_prefix_base_selection flag. We'll run experiments
      to make sure tethering stays reliable with this change enabled.
      
      Bug: 312647670
      Test: atest TetheringTests
      Change-Id: Iea03fdcf0fccad95410e79ae87fcb046d75da457
      c0b0f616
  12. Nov 21, 2023
    • Mark's avatar
      SyncSM09: Add Callback to UpstreamNetworkMonitor · 4465e4e2
      Mark authored
      Instead of passing state machine to UpstreamNetworkMonitor, wrapped it
      by an interface would have two benefits:
      1. Easier for testing.
      2. Isolate state machine operation in callback.
      
      Test: atest TetheringTests
      Change-Id: I2a97fd5cbc8c49df8c3c98428c6570916ab31ea5
      4465e4e2
  13. Nov 20, 2023
    • KH Shi's avatar
      Clean up BpfCoordinatorTest · 035bed35
      KH Shi authored
      1. assertEquals syntax is (expected, actual) and not the other way
         around
      2. use assertArrayEquals to compare arrays
      
      Test: atest TetheringTests
      Bug: 312072637
      Change-Id: I5eb0c270323253f648d3a8fd488506b9ad1ca6a1
      035bed35
    • KH Shi's avatar
      Fix endian error when pass upstream prefixes to bpf · 84e3fb3a
      KH Shi authored
      TetherUpstream6Key#src64 should be stored in network order. Use
      a big-endian ByteBuffer to retrieve a value stored in network order
      is actually converts it into native order, which is little-endian in
      Android.
      
      In this CL, we changed it to use byte[] instead of long to store the
      top 64-bits of the source prefix.
      
      Test: atest TetheringTests
            manual test with IPv6-only tethering upstream, check BPF stats.
      Bug: 312072637
      Change-Id: I79f9282d5eda28328aa6a764ea92b086d6285133
      84e3fb3a
  14. Nov 13, 2023
    • KH Shi's avatar
      Replace HashSet with ArraySet in RaParams · ff1400be
      KH Shi authored
      ArraySet is designed to be more memory afficient than HashSet. It is
      suitable to store small numbers of items.
      
      Test: atest TetheringPrivilegedTests TetheringIntegrationTests \
            TetheringTests
      Bug: 261923493
      Change-Id: I2bd2eded801cc05ce53ef9f9486b13faf1772d22
      ff1400be
  15. Nov 07, 2023
    • Mark Chien's avatar
      Remove unnecessary dropShellPermissionIdentity · f05b4475
      Mark Chien authored
      The test doesn't explicitly call adoptShellPermissionIdentity anymore. Instead it use runAsShell everywhere. Remove the dead code.
      
      Bug: 254183718
      Change-Id: Ia949e0e315a3b3ae915752e95ef9fe896fdc0f5b
      Test: TH
      f05b4475
    • KH Shi's avatar
      [Refactor] move BPF tests to BpfCoordinatorTest · cbee43da
      KH Shi authored
      Preparing for refactor of IpServer and BpfCoordinator. All BPF related
      code are planned to migrate from IpServer to BpfCoordinator. This CL
      moves BPF related tests from IpServerTest to BpfCoordinatorTest first.
      
      Test: atest TetheringTests
      Bug: 294025403
      Change-Id: I000f27c463368202dbbe2ace188c8c5146669096
      cbee43da
  16. Nov 02, 2023
  17. Oct 28, 2023
  18. Oct 26, 2023
    • KH Shi's avatar
      Pass upstream prefixes to bpf tethering offload · 3f738fcd
      KH Shi authored
      BPF needs upstream prefixes information to filter spoofing IPv6 source
      addresses carried in downstream traffic.
      
      We retrieve prefixes from upstream interface's LinkProperties and pass
      it to the BpfCoordinator. Forwarding rules will also be updated when
      upstream interface's IPv6 link addresses change.
      
      Test: atest TetheringTests
      Bug: 261923493
      Change-Id: If8cfc3b191e520ca838654d1b5211ab9e9ec021d
      3f738fcd
    • Chalard Jean's avatar
      Add forwarding methods to RoutingCoordinator · 55ccfe19
      Chalard Jean authored
      Test: RoutingCoordinatorServiceTest
            TetheringTest
      Change-Id: Ic3b36ddc236e8615e7d931b6e526556bbd2dac17
      55ccfe19
    • Mark's avatar
      SyncSM8.2: make IpServer support syncSM · be99f86a
      Mark authored
      After this change, IpServer could switch to use syncSM.
      
      Test: atest TetheringTests
      Change-Id: I2d7fa47cd020f3e76e7a8beaefb98852e93545f8
      be99f86a
    • Mark's avatar
      SyncSM8.1 always call transitionTo under processMessage · 50eef831
      Mark authored
      As state transitions always occur after a message has been processed,
      calling transitionTo only under processMessage makes the flow easier
      to understand and less error-prone.
      
      The risk of this change is very minimal since it is only about
      handling the error, but tethering will stop regardless.
      
      Test: atest TetheringTests
      
      Change-Id: I56c6cf6cc989464ee84a8333ac131afc808a3d95
      50eef831
    • Mark's avatar
      SyncSM08: handle IpServer requestEnableTethering callback in mainSM · 5cc386bd
      Mark authored
      This can make it easier to adopt SM shim replacement in follow up change,
      as both SyncSM and AsyncSM will process the same message without any
      difference.
      
      This change also fix a problem that bring up downstream before it's
      IpServer completely disabled.
      
      Previous:
      CMD_NOTIFY_PREFIX_CONFLICT -> requestEnableTethering(false) ->
      requestEnableTethering(true) -> IpServer stopped ->
      reportTetherStateChanged(downstream inactive) -> IpServer started
      -> reportTetherStateChanged(downstream active)
      New:
      CMD_NOTIFY_PREFIX_CONFLICT -> requestEnableTethering(false) ->
      IpServer stopped -> reportTetherStateChanged(downstream inactive)
      -> requestEnableTethering(true) -> IpServer started
      -> reportTetherStateChanged(downstream active)
      
      Test: atest MtsTetheringTestLatestSdk
      Change-Id: Ibe22b300c56125359f4fa452bd01a0a2381fda23
      5cc386bd
    • Mark's avatar
      SyncSM07.1: Add a test that shows tethering restarts when disabling · d81f6ef4
      Mark authored
      When tethering restarts due to an IP conflict, it starts to
      bring up downstream before its IpServer is completely disabled.
      
      Test: atest TetheringTests
      Change-Id: I0b0f0bf1bb9ac8421c05fe512d5082d095fa7180
      d81f6ef4
    • Mark's avatar
      SyncSM07: Replace IpServer's state machine with StateMachineShim · 21502964
      Mark authored
      A simple replacement without changing any behavior.
      
      Test: atest TetheringTests
      Change-Id: I34903b57df68081e974163edec82a851ee4ccc98
      21502964
    • Mark's avatar
      SyncSM06: Add StateMachineShim · 2ec1595d
      Mark authored
      Test: atest StateMachineShimTest
      
      Change-Id: Ic818aa55e7e0fd7a62dfce50a6ad719e6e1c44ec
      2ec1595d
  19. Oct 24, 2023
    • Chalard Jean's avatar
      Add a routing coordinator class · 2fb66f1b
      Chalard Jean authored
      Test: In followup changes : RoutingCoordinatorManagerTest
      Change-Id: Ia6811d614e02123a072c7638291828745abae051
      2fb66f1b
    • Mark Chien's avatar
      Fix testRequestDownstreamAddressWithoutUsingLastAddress flaky · 239860a4
      Mark Chien authored
      The problem is that the test releases mHotspotIpServer’s prefix before testing mUsbIpServer, which means that mUsbIpServer might choose the same address as mHotspotIpServer’s.
      
      To fix this, we need to test that mUsbIpServer and mHotspotIpServer have different addresses before calling releaseDownstream(mHotspotIpServer).
      
      Change-Id: Id7f7bbfeda841ec9b97e24c0f11893fa37b9ef54
      Test: TH
      Bug: 300127195
      239860a4
  20. Oct 23, 2023
  21. Oct 18, 2023
  22. Oct 17, 2023
    • Mark's avatar
      Extend tethering enable/disable timeout to 30 seconds · bb6ecfcd
      Mark authored
      The dnsmasq in R might block netd for 20 seconds, which can also
      block tethering enable/disable for 20 seconds. To fix this, changing
      the timeouts from 5 seconds to 30
      
      Bug: 289881008
      Test: TH
      Change-Id: Ibed5895b2831465d454854d7250fcc44183596e2
      bb6ecfcd
  23. Oct 13, 2023
    • Anton Kulakov's avatar
      Revert "Simplify addRoutesToLocalNetwork calls" · 316346be
      Anton Kulakov authored
      Revert submission 2777667
      
      Reason for revert: DroidMonitor-triggered revert due to breakage, bug b/305187495
      
      Reverted changes: /q/submissionid:2777667
      
      Bug: 305187495
      
      Change-Id: I516d40b20d775e9c61b2f825bc094329d016d0c3
      316346be
    • Chalard Jean's avatar
      Simplify addRoutesToLocalNetwork calls · cf70df3e
      Chalard Jean authored
      There are only three calls to this method, and two of them
      are with a list of 1 address which means it's simpler inlined.
      
      The last call will be replaced with calls to RouteController
      in a followup, meaning we addRoutesToLocalNetwork can be removed.
      
      Test: RouterAdvertisementDaemonTest
            NetdUtilsTest
      Change-Id: I3b6ee1db40f09954b336321000735a66306bf000
      cf70df3e
Loading