Commit Graph

7 Commits

Author SHA1 Message Date
Maciej Żenczykowski
a457bf7ea8 explicitly specify that offload.o & test.o bpf programs are S+
Note: due to the release version of the Connectivity/Tethering mainline
module being built from sc-mainline-prod, this won't actually take effect
until system/bpf bpfloader at version 0.6+ is merged in to that tree.

This doesn't really matter, since currently things default to v0.0+.
But there is no mainline module updatable pre-v0.2 supported OS
anyway. BpfLoader v0.2 is what shipped in Android S Beta 4 through
Android S Final.

Before S there simply was no bpfloader support for mainline updatable
ebpf code, while S Beta 3 and earlier shipped v0.0 which is badly
incompatible with even the current version of the mainline module.

Additionally v0.0 doesn't even parse this field, while v0.1 which
does was very short lived [~3 days] and can thus be utterly ignored.

As such this change is effectively a no-op, and even post merge
of bpfloader v0.6+ into sc-mainline-prod will still be effectively
a no-op.

So why do it? I want to explicitly document that these programs are S+,
so that I can change the default in the future to be T+.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7e5d0124700c7045abe16b1f3b504c9e88054ff2
2021-11-17 12:04:44 -08:00
Lorenzo Colitti
56be03eb28 Move definitions used by tethering bpf code into the module.
Bug: 167645754
Test: m com.android.tethering
Change-Id: Ia4fb1201e5f4e0c35baba7865b26b4cec0945a64
2021-02-24 12:16:05 +09:00
Maciej Żenczykowski
7dfbcf58d2 merge Tether{Down,Up}stream6Value -> Tether6Value
Test: atest TetheringTests TetheringCoverageTests
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibdbba9ef6652dd11bb18eba316045dff440fcf9e
2021-01-27 06:41:59 +00:00
Maciej Żenczykowski
5b00fbd618 switch bpf programs to group network_stack
Test: atest, TreeHugger, the programs load
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I3ab4383978acb2681a0fd5aee2700d12c62c2769
2021-01-20 18:09:32 +00:00
Maciej Żenczykowski
770e0a7a8f refactor: TetherIngress becomes TetherDownstream6 (and friends)
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: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib04dc0c6e3d034461f3f84e09f6fa93a862e1bb2
2021-01-19 23:18:46 -08:00
Maciej Żenczykowski
8c7cd343a4 add a test xdp program that drops all IPv4/UDP packets
Test: builds, boots, program present
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id5be48ec172366296929875856a3d17ecc87e84b
2021-01-20 05:20:05 +00:00
Maciej Żenczykowski
e9810ffef1 move bpf test map into a separate file
This allows for better separation of test vs production code:
we will add more test maps and programs here later.

Test: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7b22e3e148ebf43fdf43dc68d0dea354f7627688
2021-01-18 18:36:00 -08:00