Skip to content
Snippets Groups Projects
  1. Jan 27, 2021
    • Lorenzo Colitti's avatar
      Dump BPF offload rules for upstream IPv4 and IPv6. · 61976f27
      Lorenzo Colitti authored
      Add code to BpfCoordinator to dump upstream IPv4 and IPv6 rules.
      For IPv4, currently only the upstream map is printed, because the
      downstream map is expected to be symmetrical.
      
      Example output:
      
      =============
          21(21) -> 12(rmnet_data2) 86dd 00:00:00:00:00:00 00:00:00:00:00:00
          [wlan1]: iif(iface) oif(iface) v6addr srcmac dstmac
            12(rmnet_data2) 21(wlan1) /2001:240:2425:b5dc:21a9:995d:bc57:bc37 b2:b5:e0:24:21:c2 ca:06:8d:54:99:ad
          [IPv4]: iif(iface) oif(iface) src nat dst
            21(21) 12(rmnet_data2) 192.168.16.247:41544 -> 100.101.80.108:41544 -> 216.239.36.135:443
            21(21) 12(rmnet_data2) 192.168.16.247:42028 -> 100.101.80.108:42028 -> 8.8.4.4:853
            21(21) 12(rmnet_data2) 192.168.16.247:42032 -> 100.101.80.108:42032 -> 8.8.4.4:853
            21(21) 12(rmnet_data2) 192.168.16.247:42042 -> 100.101.80.108:42042 -> 8.8.4.4:853
            21(21) 12(rmnet_data2) 192.168.16.247:41816 -> 100.101.80.108:41816 -> 8.8.8.8:853
            21(21) 12(rmnet_data2) 192.168.16.247:42040 -> 100.101.80.108:42040 -> 8.8.4.4:853
      
      =============
      
      Also make it possible to do "dumpsys tethering bpf" and get only
      the BPF dump.
      
      Test: manual
      Change-Id: I2aaa2fdda7d724994090c26feff585f24cd3283b
      61976f27
    • Lorenzo Colitti's avatar
      Merge changes Iaac422d7,Ia7638b31 · 0913a7a4
      Lorenzo Colitti authored
      * changes:
        Remove IpServer.Dependencies#getIfIndex.
        Address comments on aosp/1559686.
      0913a7a4
    • Maciej Żenczykowski's avatar
      fix comments · cff64c85
      Maciej Żenczykowski authored
      
      Test: N/A
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: Ic217e08484c39077bcc408195daa3311ed93ad28
      cff64c85
  2. Jan 26, 2021
    • Lorenzo Colitti's avatar
      Remove IpServer.Dependencies#getIfIndex. · f3b201f8
      Lorenzo Colitti authored
      This code is unused.
      
      Test: atest TetheringTests
      Change-Id: Iaac422d72e8538b67798cb3ae3737deb7b426401
      f3b201f8
    • Lorenzo Colitti's avatar
      Address comments on aosp/1559686. · 51c1a95c
      Lorenzo Colitti authored
      Also remove some unnecessary line wrapping.
      
      Test: atest TetheringTests
      Change-Id: Ia7638b3198d7811cdbb34e959c50608cf1a656bf
      51c1a95c
    • Lorenzo Colitti's avatar
      Add an isEmpty convenience method to BpfMap. · 77262cea
      Lorenzo Colitti authored
      Test: new unit test
      Change-Id: Ibec09f328e24111aee4760af2f75ea5a80ba84c3
      77262cea
    • Lorenzo Colitti's avatar
      Address a TODO in BpfMapTest. · 7bf39e56
      Lorenzo Colitti authored
      Test: test-only change
      Change-Id: I9a47234979cbb161dfcd0c97c54c0476aa753c5e
      7bf39e56
    • Lorenzo Colitti's avatar
      Program the upstream IPv6 map in BpfCoordinator. · 5b1ed508
      Lorenzo Colitti authored
      - Add methods to start and stop IPv6 forwarding upstream
      - Populate the upstream IPv6 map when the first rule for any
        upstream/downstream pair is created.
      - Clear the upstream IPv6 map when the last rule for any
        upstream/downstream pair is deleted.
      
      Test: Added coverage to IpServerTest and BpfCoordinatorTest
      Change-Id: Ib041081e95f5f449489ab63138de034222ffac8f
      5b1ed508
    • Lorenzo Colitti's avatar
      Rename TetherDownstream6Value to Tether6Value. · d69a8862
      Lorenzo Colitti authored
      The two value types are identical so there is no need to have
      separate classes for them.
      
      Test: atest TetheringTests
      Change-Id: Ia622b082d0a44373d21f51222f5e675e5bde08e0
      d69a8862
    • Lorenzo Colitti's avatar
      Merge changes from topic "bpf_tether4_rename" · 3c356668
      Lorenzo Colitti authored
      * changes:
        merge Tether{Down,Up}stream4{Key,Value} - part 3 - fixups
        merge Tether{Down,Up}stream4{Key,Value} - part 2 - java
        merge Tether{Down,Up}stream4{Key,Value} - part 1 - C portion
      3c356668
    • Lorenzo Colitti's avatar
      Mark the EntitlementManager PendingIntents as immutable. · a36d65da
      Lorenzo Colitti authored
      These are read-only intents and should not be mutated by any
      app receiving them.
      
      Bug: 178324405
      Bug: 178249531
      Test: atest TetheringTests TetheringCoverageTests GtsTetheringTestCases
      Change-Id: I5395e7c19e6453640ad790f2b9a9ba22bbcefa88
      a36d65da
    • Lorenzo Colitti's avatar
      Fix a WTF in IpServerTest. · ae27ecf5
      Lorenzo Colitti authored
      Bug: 178324405
      Test: atest TetheringTests
      Change-Id: I2069ea79f982e6bb197388edd7820a05d1e651f1
      ae27ecf5
    • Maciej Żenczykowski's avatar
      merge Tether{Down,Up}stream4{Key,Value} - part 3 - fixups · 911a7267
      Maciej Żenczykowski authored
      
      Test: atest, TreeHugger
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: Ia7840698e80ded33d8e0b59efe1ca7267254b892
      911a7267
    • Maciej Żenczykowski's avatar
      merge Tether{Down,Up}stream4{Key,Value} - part 2 - java · 32874eb6
      Maciej Żenczykowski authored
      
      Generated via:
        git grep 'Tether(Down|Up)stream4(Key|Value)' | cut -d: -f1 | sort -u | while read i; do
          sed -r -i 's@TetherUpstream4Value@Tether4Value@g' "$i"
          sed -r -i 's@TetherDownstream4Value@Tether4Value@g' "$i"
          sed -r -i 's@TetherDownstream4Key@Tether4Key@g' "$i"
          sed -r -i 's@TetherUpstream4Key@Tether4Key@g' "$i"
        done
      
        cd Tethering/src/com/android/networkstack/tethering
        git mv TetherUpstream4Key.java Tether4Key.java
        git mv TetherUpstream4Value.java Tether4Value.java
      
        git diff TetherDownstream4Key.java Tether4Key.java
        git diff TetherDownstream4Value.java Tether4Value.java
        git rm TetherDownstream4Key.java
        git rm TetherDownstream4Value.java
      
      Fixup resulting 'import' duplication
        mcedit Tethering/apishim/31/com/android/networkstack/tethering/apishim/api31/BpfCoordinatorShimImpl.java
        mcedit Tethering/apishim/30/com/android/networkstack/tethering/apishim/api30/BpfCoordinatorShimImpl.java
        mcedit Tethering/apishim/common/com/android/networkstack/tethering/apishim/common/BpfCoordinatorShim.java
        mcedit Tethering/tests/unit/src/android/net/ip/IpServerTest.java
      
      Test: N/A, requires follow up commit
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: I1dfc3108ca4bbd0cefc3420bc7e421594b62619c
      32874eb6
    • Maciej Żenczykowski's avatar
      merge Tether{Down,Up}stream4{Key,Value} - part 1 - C portion · 1feb8b4a
      Maciej Żenczykowski authored
      
      The keys are identical, and the values nearly so, this will make everyone's life easier.
      
      Test: git grep 'Tether(Down|Up)stream4(Key|Value)' finds nothing
        (note this requires follow up commits)
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: Ifbff2c617ac5834ea80f827eaf89ca81e862baec
      1feb8b4a
    • Lorenzo Colitti's avatar
      Merge changes I8cd6e49b,Ibb52c7b7 · dc4189f0
      Lorenzo Colitti authored
      * changes:
        [NFCT.TETHER.10] Add/delete IPv4 offload BPF rules to/from BPF map
        [NFCT.TETHER.9] Build IPv4 offload BPF rules for raw ip
      dc4189f0
  3. Jan 25, 2021
  4. Jan 23, 2021
  5. Jan 22, 2021
  6. Jan 21, 2021
  7. Jan 20, 2021
    • Maciej Żenczykowski's avatar
      switch bpf programs to group network_stack · 5b00fbd6
      Maciej Żenczykowski authored
      
      Test: atest, TreeHugger, the programs load
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: I3ab4383978acb2681a0fd5aee2700d12c62c2769
      5b00fbd6
    • Maciej Żenczykowski's avatar
      Add tethering programs for upstream. · bca0c858
      Maciej Żenczykowski authored
      
      Test: atest, TreeHugger, the programs load
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: I26bc60c1066ed7317bda48ec3fa701c36e0b46dd
      bca0c858
    • Maciej Żenczykowski's avatar
      refactor: continued · a0e2c044
      Maciej Żenczykowski authored
      
      Test: builds, atest, TreeHugger
        git grep 'makeIngressKey|makeIngressValue|BpfIngressMap|TETHER_INGRESS_FS_PATH'
        no longer finds anything
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: I27200d33cbc4ea2094b18e05bf93ab54c564da0b
      a0e2c044
    • Maciej Żenczykowski's avatar
      refactor: TetherIngress becomes TetherDownstream6 (and friends) · 770e0a7a
      Maciej Żenczykowski authored
      
      Generated via:
        #!/bin/bash
      
        do_replace() {
          pushd "$1" >/dev/null
          shift
          git grep "$1" | cut -d: -f1 | sort -u | while read f; do
            sed -i -r "s@$1@$2@g" "${f}"
            git add "${f}"
          done
          popd >/dev/null
        }
      
        replace() {
          do_replace packages/modules/Connectivity/Tethering "$@"
          do_replace system/netd "$@"
        }
      
        do_reset() {
          pushd "$1" >/dev/null
          git rhh
          popd >/dev/null
        }
      
        main() {
          do_reset packages/modules/Connectivity/Tethering
          do_reset system/netd
      
          replace TetherIngressKey TetherDownstream6Key
          replace TetherIngressValue TetherDownstream6Value
      
          pushd packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering >/dev/null
          git mv TetherIngressKey.java TetherDownstream6Key.java
          git mv TetherIngressValue.java TetherDownstream6Value.java
          popd >/dev/null
      
          replace TETHER_INGRESS_PROG TETHER_DOWNSTREAM6_TC_PROG
          replace ingress_tether tether_downstream6
          replace ingress/tether_ tether_downstream6_
          replace TETHER_INGRESS_MAP TETHER_DOWNSTREAM6_MAP
          replace tether_ingress_map tether_downstream6_map
      
          replace getTetherIngressMapFd getTetherDownstream6MapFd
          replace getTetherIngressProgFd getTetherDownstream6TcProgFd
      
          replace mBpfIngressMap mBpfDownstream6Map
          replace bpfIngressMap bpfDownstream6Map
          replace printIngressMap printDownstream6Map
          replace 'BPF ingress map' 'BPF downstream ipv6 map'
        }
      
        main "$@"; exit
      
      Followed by:
        cd system/netd
        # change regexp in tests/binder_test.cpp:3374
        git add tests/binder_test.cpp
      
      (and whitespace adjustments to prevent lines from going over 100 characters)
      
      Afterwards we have:
        $ adbz shell ls /sys/fs/bpf/tethering
        map_offload_tether_downstream6_map
        map_offload_tether_limit_map
        map_offload_tether_stats_map
        map_test_tether_downstream6_map
        prog_offload_schedcls_tether_downstream6_ether
        prog_offload_schedcls_tether_downstream6_rawip
        prog_test_xdp_drop_ipv4_udp_ether
      
      Test: atest, TreeHugger
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: Ib04dc0c6e3d034461f3f84e09f6fa93a862e1bb2
      770e0a7a
    • Maciej Żenczykowski's avatar
    • Treehugger Robot's avatar
    • Maciej Żenczykowski's avatar
      add a test xdp program that drops all IPv4/UDP packets · 8c7cd343
      Maciej Żenczykowski authored
      
      Test: builds, boots, program present
      Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
      Change-Id: Id5be48ec172366296929875856a3d17ecc87e84b
      8c7cd343
Loading