]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit41c1c1137ff7f58bc8384aecd958c0e27d5eccaa
tree9d998b6f8ae66f6e50c48fff7136c3b93a157021
parentb6ffb69ea2ef1242c8bfcdc020a90b73921f2dd9
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