]> git.baikalelectronics.ru Git - kernel.git/commit
ebpf: add helper to retrieve net_cls's classid cookie
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 15 Jul 2015 12:21:42 +0000 (14:21 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Jul 2015 19:41:30 +0000 (12:41 -0700)
commit671d18d9da7a604ff49fb6f81bdd5c51203f4034
treebe182dc2e3829040518d72c41363ffec458f1245
parent9f64136e66b9c3e0d80276969e22e13d029cb8cc
ebpf: add helper to retrieve net_cls's classid cookie

It would be very useful to retrieve the net_cls's classid from an eBPF
program to allow for a more fine-grained classification, it could be
directly used or in conjunction with additional policies. I.e. docker,
but also tooling such as cgexec, can easily run applications via net_cls
cgroups:

  cgcreate -g net_cls:/foo
  echo 42 > foo/net_cls.classid
  cgexec -g net_cls:foo <prog>

Thus, their respecitve classid cookie of foo can then be looked up on
the egress path to apply further policies. The helper is desigend such
that a non-zero value returns the cgroup id.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Thomas Graf <tgraf@suug.ch>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/bpf.h
net/core/filter.c