• Yonghong Song's avatar
    tools/bpf: add more netlink functionalities in lib/bpf · 36f1678d
    Yonghong Song authored
    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: default avatarYonghong Song <yhs@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    36f1678d
libbpf.h 11.1 KB