-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
long tc program names are not truncated, causing a netlink error #610
long tc program names are not truncated, causing a netlink error #610
Comments
oh... I change |
I would guess the name is too long. Would be interesting where the ENOSPC comes from though. |
it seems the error reported by this Line 491 in 58f1ecb
|
Ah yeah here's the issue. Name should probably be truncated here: Line 134 in 58f1ecb
|
According to the kernel code, the name can be up to 256 bytes long: #define CLS_BPF_NAME_LEN 256 And realised you have set the total length of attributes to 64 bytes: #[repr(C)]
struct TcRequest {
header: nlmsghdr,
tc_info: tcmsg,
attrs: [u8; 64],
} I increased the length of the attributes and it works fine until the name reaches 256 bytes limit enforced by kernel and this error appears:
So we can conclude that the limit is enforced by Aya not the kernel. |
@pooladkhay could you send a patch that increases this limit with a test? I'd be happy to guide you through writing the test. |
@tamird Yeah I'd love to do that, In the meantime I'd really appreciate it if you tell me more about the test. |
By increasing the attrs length to a number that can accommodate 256-bytes-long tc names enforced by the kernel, aya no longer limits this attribute. 292 is the smallest possible size which is divisible by 4 (alignment requirement). Fixes: aya-rs#610
By increasing the attrs length to a number that can accommodate 256-bytes-long tc names enforced by the kernel, aya no longer limits this attribute. 292 is the smallest possible size which is divisible by 4 (alignment requirement). Fixes: aya-rs#610
Ah, sorry I missed your reply. The tests are in the |
Actually, this may be the test you're looking for:
|
@tamird No worries, |
The buffer for attributes should be sized to hold at least 256 bytes, based on `CLS_BPF_NAME_LEN = 256` from the kernel: https://github.com/torvalds/linux/blob/02aee814/net/sched/cls_bpf.c#L28 This commit also includes integration tests with an eBPF program of type classifier with a 256-byte-long name. Fixes: aya-rs#610
The buffer for attributes should be sized to hold at least 256 bytes, based on `CLS_BPF_NAME_LEN = 256` from the kernel: https://github.com/torvalds/linux/blob/02aee814/net/sched/cls_bpf.c#L28 This commit also includes integration tests with an eBPF program of type classifier with a 256-byte-long name. Fixes: aya-rs#610 integration-ebpf: fix Cargo.toml formatting
The buffer for attributes should be sized to hold at least 256 bytes, based on `CLS_BPF_NAME_LEN = 256` from the kernel: https://github.com/torvalds/linux/blob/02aee814/net/sched/cls_bpf.c#L28 Fixes: aya-rs#610 aya: add netlink_clsact_qdisc_exists function public-api: add clsact_qdisc_exists integration-test: add tc_name_limit integration-test: add tc_name_limit_exceeded Signed-off-by: Mohammad Javad Pooladkhay <m.pooladkhay@gmail.com>
when this error message reported, what is the real reason?
I can't attach this Sherlock-Holo/mahiro@fe85104#diff-b47e6e512f3e362859296f1fca2c484e0699ca24db91fcf4813a04af127701a4R20 bpf program, however, I can attach Sherlock-Holo/mahiro@fe85104#diff-b47e6e512f3e362859296f1fca2c484e0699ca24db91fcf4813a04af127701a4R16
The text was updated successfully, but these errors were encountered: