From 716a29ad165931c8b82241604456fdd47f25ecbc Mon Sep 17 00:00:00 2001 From: Mohammad Javad Pooladkhay Date: Sat, 25 Nov 2023 01:05:08 +0000 Subject: [PATCH] aya: add comment explaining the chosen size for attrs buffer Signed-off-by: Mohammad Javad Pooladkhay --- aya/src/sys/netlink.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aya/src/sys/netlink.rs b/aya/src/sys/netlink.rs index 7fe39644..c58d2d49 100644 --- a/aya/src/sys/netlink.rs +++ b/aya/src/sys/netlink.rs @@ -332,6 +332,9 @@ struct TcRequest { // 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 + // We currently use around ~30 bytes of attributes in addition to name. + // Rather than picking a "right sized buffer" for the payload (which is of + // varying length anyway) we use the next largest power of 2. attrs: [u8; 512], }