Commit Graph

20 Commits

Author SHA1 Message Date
Motomu Utsumi
c480039309 Merge remote-tracking branch 'remotes/aosp/tmp_libs_net_move' into libs_net_move_merge
frameworks/libs/net/common ->
packages/modules/Connectivity/staticlibs

frameworks/libs/net/client-libs ->
packages/modules/Connectivity/staticlbs/client-libs

Test: TH
Bug: 296014682
Change-Id: I5dc78f0c4653e20312ab3d488b1e69262dbb9840
2023-09-11 11:53:46 +09:00
Patrick Rohr
66452f566b bpf_headers: rename KernelVersion.h to KernelUtils.h
Test: TH
Change-Id: Ifacc159c19a8fcb64b571295b945fb9fca82496a
2023-05-17 11:43:02 -07:00
Maciej Żenczykowski
d7d3b03e13 dedup kernelversion.h
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie7a4dd46122e86bf808d0a3ac566075e1c3a2cd4
2022-12-24 17:17:14 +00:00
Maciej Żenczykowski
41abe75ba7 updated TODO's for bpf_shared.h -> netd.h rename
Test: TreeHugger
Signed-off: Maciej Żenczykowski <maze@google.com>
Change-Id: I44bb430f176161cafd6dfbd5e26e61dbe2a0183a
2022-12-08 16:40:28 +00:00
Maciej Żenczykowski
af0ae6785f fix wrong bpf path
(also note the program in p/m/C netd.C is not optional or kernel version dependent)

Bug: 237030932
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia984f6a1ce0ab14a204fe47ec295db1363879b7b
2022-08-10 18:22:40 +00:00
Maciej Żenczykowski
e8dceddeec enable NETLINK_EXT_ACK extended error reporting
(we don't yet do anything with it, but at least in strace we should
now see more detailed errors from the kernel)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6a34a0e7e866bbde41daef23870ad90dceee6ded
2022-06-10 21:10:15 +00:00
Maciej Żenczykowski
0b2781b5ec add ALOGW/ALOGI/ALOGD to logging.h
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I99c7892f10f89a81e0c18838328aa7f945a3817a
2022-06-10 19:00:07 +00:00
Maciej Żenczykowski
9a276e68f8 Fix parsing of kernel version 5.18-rc1
Test: TreeHugger
Bug: 234125620
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I624927cacd2722f4fc61ef419de74254cecdd77b
2022-05-27 19:43:47 +00:00
Maciej Żenczykowski
eeb588721e cache kernelVersion(), make isAtLeastKernelVersion() cheaper
not perfect due to this being in a header file, so multiple copies
potentially exist, but it's really simple, and works nearly as well.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Id90c6933d57bc12f4dd640c8918fd0885c7474cf
2022-05-25 12:41:25 -07:00
Patrick Rohr
ba48d10969 Make libtcutils visible to netd tests
Test: TH
Change-Id: I71943cfd2fb72dca8a7ffd5d063860b89be47ca1
2022-03-30 09:38:06 +02:00
Patrick Rohr
20dcaf5f70 Fix wrong nla_type for matchall
TCA_U32_ACT was missed when converting from the u32 filter to matchall.
Interestingly, cls_matchall does not seem to validate this type as the
kernel happily accepted this configuration (which absolutely should not
happen as TCA_U32_ACT is greater than __TCA_MATCHALL_MAX).

Bug: 218840346
Test: atest CtsNetTestCases:RateLimitTest
Change-Id: Ia24683cbd5fbd10084163db6e6a4415ec03f6f3f
2022-02-11 13:24:51 +01:00
Patrick Rohr
28c717a03e Move logging helper to own file
And rename to ALOGE to be in line with liblog.

Test: builds
Change-Id: I6c33f78a0649b273f75ebf05ea5ba3689beabc24
2022-01-19 14:54:37 +01:00
Patrick Rohr
e815a7462f Add functionality to attach tc-police action to ingress qdisc
This is used for go/bandwidth-limiting.

Bug: 157552970
Test: atest LibTcUtilsTest
Change-Id: Ic8e4d8dc016b14a6d4fc8ddbb3949941e9ef95af
2022-01-19 14:20:27 +01:00
Patrick Rohr
1f7ba259c3 Add tests for adding / deleting bpf filter
Bug: 202086915
Bug: 157552970
Test: atest LibTcUtilsTest
Change-Id: I8adcb3df29e4b3e0c558714f90b2840698e40cb9
2022-01-19 14:20:27 +01:00
Patrick Rohr
42b58ae836 Add support to attach / replace / detach clsact qdisc to libtcutils
Bug: 202086915
Bug: 157552970
Test: atest LibTcUtilsTest
Change-Id: I2f2e2f66acb7590e8951ac6e178c5893ba635597
2022-01-19 14:20:27 +01:00
Patrick Rohr
27846ff7a2 Add tests for libtcutils
Add tests for isEthernet(). Before I can add tests for the other
functions, I need to move tcQdiscAddDevClsact into libtcutils.

Bug: 202086915
Bug: 157552970
Test: atest LibTcUtilsTest
Change-Id: Id51e87bb76bc42a055f71027c94c51fcb76be209
2022-01-19 14:20:27 +01:00
Patrick Rohr
0c34e9a084 Fix kernelversion.h
Add missing pragma once and static inline all functions.

Bug: 202086915
Bug: 157552970
Test: builds
Change-Id: I8aca683e9e60c33bf5a5ac45cc20c2e59c8eecde
2022-01-19 14:20:27 +01:00
Patrick Rohr
e7f26e2a4d Move BpfUtils -- move kernelVersion code to its own header
Move kernelVersion and isAtLeastKernelVersion to a local kernelversion.h,
since we cannot use bpf_headers' version of BpfUtils.

Bug: 202086915
Bug: 157552970
Test: builds
Change-Id: I83149b76cc5125991bdb52ce6160c497eb52b48b
2022-01-13 22:24:29 +01:00
Patrick Rohr
299a85e4f5 Move BpfUtils -- make libtcutils visible to package/modules/Connectivity
Bug: 202086915
Bug: 157552970
Test: builds
Change-Id: Ie9b34bbe5263e34c592a73a2ca828d0f3f48e564
2022-01-13 22:24:29 +01:00
Patrick Rohr
776c40cf65 Move BpfUtils -- add libtcutils
This CL is copying the "generic" parts of BpfUtils to
frameworks/libs/net/common. "Generic" meaning the parts that will be
used by both TcUtils in frameworks/libs/net/common and netd.

Bug: 202086915
Bug: 157552970
Test: atest TetheringTests
Change-Id: I9e780fc22e30d046f44953a8cac7687cb6c721c7
2022-01-12 21:34:52 +01:00