Commit Graph

11 Commits

Author SHA1 Message Date
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
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
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
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
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