]> git.baikalelectronics.ru Git - kernel.git/commit
tools/bpf: add more netlink functionalities in lib/bpf
authorYonghong Song <yhs@fb.com>
Wed, 5 Sep 2018 23:58:05 +0000 (16:58 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 7 Sep 2018 05:34:08 +0000 (22:34 -0700)
commit811a55a2a416e34ead30b39f71e3b17bc2e7ec0d
tree61179eacb8d5baa5f2c9e6331da3f919de1e4b1d
parent7db325d1d0a2dd7d716d4efde2ab25fbe6a141a8
tools/bpf: add more netlink functionalities in lib/bpf

This patch added a few netlink attribute parsing functions
and the netlink API functions to query networking links, tc classes,
tc qdiscs and tc filters. For example, the following API is
to get networking links:
  int nl_get_link(int sock, unsigned int nl_pid,
                  dump_nlmsg_t dump_link_nlmsg,
                  void *cookie);

Note that when the API is called, the user also provided a
callback function with the following signature:
  int (*dump_nlmsg_t)(void *cookie, void *msg, struct nlattr **tb);

The "cookie" is the parameter the user passed to the API and will
be available for the callback function.
The "msg" is the information about the result, e.g., ifinfomsg or
tcmsg. The "tb" is the parsed netlink attributes.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf.h
tools/lib/bpf/libbpf_errno.c
tools/lib/bpf/netlink.c
tools/lib/bpf/nlattr.c
tools/lib/bpf/nlattr.h