Re: Bridge zeros out skb->cb in 5.2 (not in 5.1)
From: Florian Westphal <fw@strlen.de>
Date: 2019-08-23 09:12:39
Also in:
bpf
Dan Siemon [off-list ref] wrote: [ CCing bpf maling list ]
Commit f12064d1b402c60c5db9c4b63d5ed6d7facb33f6 zeros out skb->cb in br_input.c: memset(skb->cb, 0, sizeof(struct br_input_skb_cb)); https://github.com/torvalds/linux/commit/f12064d1b402c60c5db9c4b63d5ed6d7facb33f6 Prior to 5.2, it was possible to store information in skb->cb and have it pass through the bridge to the output link.
I did not know this was even possible. Any owner of the skb (bridge, ip stack, etc.) use skb->cb[] as they see fit.
We leveraged this to have a BPF prog that runs on ingress and does custom packet parsing and stores the output qdisc:class in skb->cb. This enabled the egress BPF filter to be super simple and avoid having to parse the entire packet again. Note I haven't built with this patch removed so it's possible this isn't the problem but the memset is unconditional...
You're not exactly saying what the problem is, so I have no idea.
Is this a regression? Is it expected that the bridge would wipe this field when just passing frames?
Even if you remove the memset, that commit br_input_skb_cb has existed, and is used. Fields were just cleared on-demand rather than unconditionally at the start. I think the latter is better practice and also what other owners do. So please explain what exactly the problem is and/or check that the cb clearing "is the problem". If it is, I have no idea how to fix it.