Commit graph android_packages_modules_Co.../staticlibs/native/tcutils/tcutils.cpp
Message SHA1
TcUtils: allow ignoring netlink error code ENOENT
Ignore this error code during DEL operations.

It is returned when the specific thing to be deleted
is not found and is therefore a valid response.

Gets rid of 30+ logs worth of:
  E TcUtils : NLMSG_ERROR message return error: -2
during netd startup (cleanup phase).

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie542f8ff418dbed604eea5b31b87f9b974ccdbcb

Maciej Żenczykowski   commited 2025-02-06 12:56:09 -08:00
f31a45416c
Use unique_fd in tcutils
Since libbase is available now, make use of it.

Test: m
Change-Id: I5676863f80f19913d68e95ebeef477c5ca399e35

Patrick Rohr   commited 2024-05-22 10:51:02 -07:00
6b84b40a29
Use scopeguard from libbase_headers and delete the copy
A recent change makes libbase_headers available to the tethering apex.

Test: m
Change-Id: Id4f30f48bd65175e17c419230a8e7ebf5339d713

Patrick Rohr   commited 2024-05-22 10:50:55 -07:00
15754248e8
bpf_headers: rename KernelVersion.h to KernelUtils.h
Test: TH
Change-Id: Ifacc159c19a8fcb64b571295b945fb9fca82496a

Patrick Rohr   commited 2023-05-17 11:43:02 -07:00
66452f566b
dedup kernelversion.h
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie7a4dd46122e86bf808d0a3ac566075e1c3a2cd4

Maciej Żenczykowski   commited 2022-12-24 17:17:14 +00:00
d7d3b03e13
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

Maciej Żenczykowski   commited 2022-06-10 21:10:15 +00:00
e8dceddeec
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

Patrick Rohr   commited 2022-02-11 13:24:51 +01:00
20dcaf5f70
Move logging helper to own file
And rename to ALOGE to be in line with liblog.

Test: builds
Change-Id: I6c33f78a0649b273f75ebf05ea5ba3689beabc24

Patrick Rohr   commited 2022-01-19 14:54:37 +01:00
28c717a03e
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

Patrick Rohr   commited 2022-01-19 14:20:27 +01:00
e815a7462f
Add support to attach / replace / detach clsact qdisc to libtcutils
Bug: 202086915
Bug: 157552970
Test: atest LibTcUtilsTest
Change-Id: I2f2e2f66acb7590e8951ac6e178c5893ba635597

Patrick Rohr   commited 2022-01-19 14:20:27 +01:00
42b58ae836
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

Patrick Rohr   commited 2022-01-19 14:20:27 +01:00
27846ff7a2
Fix kernelversion.h
Add missing pragma once and static inline all functions.

Bug: 202086915
Bug: 157552970
Test: builds
Change-Id: I8aca683e9e60c33bf5a5ac45cc20c2e59c8eecde

Patrick Rohr   commited 2022-01-19 14:20:27 +01:00
0c34e9a084
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

Patrick Rohr   commited 2022-01-13 22:24:29 +01:00
e7f26e2a4d
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

Patrick Rohr   commited 2022-01-12 21:34:52 +01:00
776c40cf65