bpf: allow BPF programs access skb->skb_iif and skb->dev->ifindex fields
authorAlexei Starovoitov <ast@plumgrid.com>
Wed, 27 May 2015 22:30:39 +0000 (15:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 31 May 2015 00:51:13 +0000 (17:51 -0700)
commit37e82c2f974b72c9ab49c787ef7b5bb1aec12768
tree9d998b6f8ae66f6e50c48fff7136c3b93a157021
parente01ec2199ef22e2cabd7d6e68a192f3eb728029f
bpf: allow BPF programs access skb->skb_iif and skb->dev->ifindex fields

classic BPF already exposes skb->dev->ifindex via SKF_AD_IFINDEX extension.
Allow eBPF program to access it as well. Note that classic aborts execution
of the program if 'skb->dev == NULL' (which is inconvenient for program
writers), whereas eBPF returns zero in such case.
Also expose the 'skb_iif' field, since programs triggered by redirected
packet need to known the original interface index.
Summary:
__skb->ifindex         -> skb->dev->ifindex
__skb->ingress_ifindex -> skb->skb_iif

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/bpf.h
net/core/filter.c
This page took 0.02654 seconds and 5 git commands to generate.