History

bpf: allow programs to write to certain skb fields

allow programs read/write skb->mark, tc_index fields and ((struct qdisc_skb_cb *)cb)->data. mark and tc_index are generically useful in TC. cb[0]-cb[4] are primarily used to pass arguments from one program to another called via bpf_tail_call() which can be seen in sockex3_kern.c example. All fields of 'struct __sk_buff' are readable to socket and tc_cls_act progs. mark, tc_index are writeable from tc_cls_act only. cb[0]-cb[4] are writeable by both sockets and tc_cls_act. Add verifier tests and improve sample code.

Alexei Starovoitov committed 11 years ago

Commit d691f9e1 parent 34312056 files · +207 −48Browse files

Showing the changes to include/uapi (1 of 6 files). Show all

Unified · Split

include/uapi/linux/bpf.h+2−0
@@ -248,6 +248,8 @@ struct __sk_buff { · 247 unmodified lines
248 __u32 priority;248 __u32 priority;
249 __u32 ingress_ifindex;249 __u32 ingress_ifindex;
250 __u32 ifindex;250 __u32 ifindex;
251 __u32 tc_index;
252 __u32 cb[5];
251};253};
252 254
253#endif /* _UAPI__LINUX_BPF_H__ */255#endif /* _UAPI__LINUX_BPF_H__ */