On Wed, Apr 4, 2018 at 2:34 AM, Mathieu Xhonneux <m.xhonn...@gmail.com> wrote: > 2018-04-03 16:25 GMT+02:00 David Lebrun <dav.leb...@gmail.com>: >> Actually I'm wrong here. dst_input() will call either ip6_input() or >> ip6_forward(), not ipv6_rcv(). Both functions expect IP6CB() to be set, >> so using skb->cb here will interfere with them. >> >> What about saving and restoring the IPv6 CB, similarly to what TCP does with >> tcp_v6_restore_cb() ? > > > Yes. I can change the call to bpf_prog_run_save_cb to bpf_prog_run_clear_cb, > and then manually save/restore the IPv6 CB in input_action_end_bpf. > > Or is there maybe a better solution to share some state between the bpf caller > and helpers, that does not need access to skb->cb ?
I think per-cpu scratch buffer approach can work for this situation. Similar to one used by do_redirect and sockmap.