|
@@ -18,10 +18,10 @@
|
|
#define SOL_NETLINK 270
|
|
#define SOL_NETLINK 270
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-typedef int (*__dump_nlmsg_t)(struct nlmsghdr *nlmsg, dump_nlmsg_t,
|
|
|
|
|
|
+typedef int (*__dump_nlmsg_t)(struct nlmsghdr *nlmsg, libbpf_dump_nlmsg_t,
|
|
void *cookie);
|
|
void *cookie);
|
|
|
|
|
|
-int bpf_netlink_open(__u32 *nl_pid)
|
|
|
|
|
|
+int libbpf_netlink_open(__u32 *nl_pid)
|
|
{
|
|
{
|
|
struct sockaddr_nl sa;
|
|
struct sockaddr_nl sa;
|
|
socklen_t addrlen;
|
|
socklen_t addrlen;
|
|
@@ -65,7 +65,7 @@ cleanup:
|
|
}
|
|
}
|
|
|
|
|
|
static int bpf_netlink_recv(int sock, __u32 nl_pid, int seq,
|
|
static int bpf_netlink_recv(int sock, __u32 nl_pid, int seq,
|
|
- __dump_nlmsg_t _fn, dump_nlmsg_t fn,
|
|
|
|
|
|
+ __dump_nlmsg_t _fn, libbpf_dump_nlmsg_t fn,
|
|
void *cookie)
|
|
void *cookie)
|
|
{
|
|
{
|
|
bool multipart = true;
|
|
bool multipart = true;
|
|
@@ -133,7 +133,7 @@ int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags)
|
|
} req;
|
|
} req;
|
|
__u32 nl_pid;
|
|
__u32 nl_pid;
|
|
|
|
|
|
- sock = bpf_netlink_open(&nl_pid);
|
|
|
|
|
|
+ sock = libbpf_netlink_open(&nl_pid);
|
|
if (sock < 0)
|
|
if (sock < 0)
|
|
return sock;
|
|
return sock;
|
|
|
|
|
|
@@ -181,8 +181,8 @@ cleanup:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int __dump_link_nlmsg(struct nlmsghdr *nlh, dump_nlmsg_t dump_link_nlmsg,
|
|
|
|
- void *cookie)
|
|
|
|
|
|
+static int __dump_link_nlmsg(struct nlmsghdr *nlh,
|
|
|
|
+ libbpf_dump_nlmsg_t dump_link_nlmsg, void *cookie)
|
|
{
|
|
{
|
|
struct nlattr *tb[IFLA_MAX + 1], *attr;
|
|
struct nlattr *tb[IFLA_MAX + 1], *attr;
|
|
struct ifinfomsg *ifi = NLMSG_DATA(nlh);
|
|
struct ifinfomsg *ifi = NLMSG_DATA(nlh);
|
|
@@ -196,8 +196,8 @@ static int __dump_link_nlmsg(struct nlmsghdr *nlh, dump_nlmsg_t dump_link_nlmsg,
|
|
return dump_link_nlmsg(cookie, ifi, tb);
|
|
return dump_link_nlmsg(cookie, ifi, tb);
|
|
}
|
|
}
|
|
|
|
|
|
-int nl_get_link(int sock, unsigned int nl_pid, dump_nlmsg_t dump_link_nlmsg,
|
|
|
|
- void *cookie)
|
|
|
|
|
|
+int libbpf_nl_get_link(int sock, unsigned int nl_pid,
|
|
|
|
+ libbpf_dump_nlmsg_t dump_link_nlmsg, void *cookie)
|
|
{
|
|
{
|
|
struct {
|
|
struct {
|
|
struct nlmsghdr nlh;
|
|
struct nlmsghdr nlh;
|
|
@@ -219,7 +219,8 @@ int nl_get_link(int sock, unsigned int nl_pid, dump_nlmsg_t dump_link_nlmsg,
|
|
}
|
|
}
|
|
|
|
|
|
static int __dump_class_nlmsg(struct nlmsghdr *nlh,
|
|
static int __dump_class_nlmsg(struct nlmsghdr *nlh,
|
|
- dump_nlmsg_t dump_class_nlmsg, void *cookie)
|
|
|
|
|
|
+ libbpf_dump_nlmsg_t dump_class_nlmsg,
|
|
|
|
+ void *cookie)
|
|
{
|
|
{
|
|
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
@@ -233,8 +234,8 @@ static int __dump_class_nlmsg(struct nlmsghdr *nlh,
|
|
return dump_class_nlmsg(cookie, t, tb);
|
|
return dump_class_nlmsg(cookie, t, tb);
|
|
}
|
|
}
|
|
|
|
|
|
-int nl_get_class(int sock, unsigned int nl_pid, int ifindex,
|
|
|
|
- dump_nlmsg_t dump_class_nlmsg, void *cookie)
|
|
|
|
|
|
+int libbpf_nl_get_class(int sock, unsigned int nl_pid, int ifindex,
|
|
|
|
+ libbpf_dump_nlmsg_t dump_class_nlmsg, void *cookie)
|
|
{
|
|
{
|
|
struct {
|
|
struct {
|
|
struct nlmsghdr nlh;
|
|
struct nlmsghdr nlh;
|
|
@@ -257,7 +258,8 @@ int nl_get_class(int sock, unsigned int nl_pid, int ifindex,
|
|
}
|
|
}
|
|
|
|
|
|
static int __dump_qdisc_nlmsg(struct nlmsghdr *nlh,
|
|
static int __dump_qdisc_nlmsg(struct nlmsghdr *nlh,
|
|
- dump_nlmsg_t dump_qdisc_nlmsg, void *cookie)
|
|
|
|
|
|
+ libbpf_dump_nlmsg_t dump_qdisc_nlmsg,
|
|
|
|
+ void *cookie)
|
|
{
|
|
{
|
|
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
@@ -271,8 +273,8 @@ static int __dump_qdisc_nlmsg(struct nlmsghdr *nlh,
|
|
return dump_qdisc_nlmsg(cookie, t, tb);
|
|
return dump_qdisc_nlmsg(cookie, t, tb);
|
|
}
|
|
}
|
|
|
|
|
|
-int nl_get_qdisc(int sock, unsigned int nl_pid, int ifindex,
|
|
|
|
- dump_nlmsg_t dump_qdisc_nlmsg, void *cookie)
|
|
|
|
|
|
+int libbpf_nl_get_qdisc(int sock, unsigned int nl_pid, int ifindex,
|
|
|
|
+ libbpf_dump_nlmsg_t dump_qdisc_nlmsg, void *cookie)
|
|
{
|
|
{
|
|
struct {
|
|
struct {
|
|
struct nlmsghdr nlh;
|
|
struct nlmsghdr nlh;
|
|
@@ -295,7 +297,8 @@ int nl_get_qdisc(int sock, unsigned int nl_pid, int ifindex,
|
|
}
|
|
}
|
|
|
|
|
|
static int __dump_filter_nlmsg(struct nlmsghdr *nlh,
|
|
static int __dump_filter_nlmsg(struct nlmsghdr *nlh,
|
|
- dump_nlmsg_t dump_filter_nlmsg, void *cookie)
|
|
|
|
|
|
+ libbpf_dump_nlmsg_t dump_filter_nlmsg,
|
|
|
|
+ void *cookie)
|
|
{
|
|
{
|
|
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
@@ -309,8 +312,8 @@ static int __dump_filter_nlmsg(struct nlmsghdr *nlh,
|
|
return dump_filter_nlmsg(cookie, t, tb);
|
|
return dump_filter_nlmsg(cookie, t, tb);
|
|
}
|
|
}
|
|
|
|
|
|
-int nl_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle,
|
|
|
|
- dump_nlmsg_t dump_filter_nlmsg, void *cookie)
|
|
|
|
|
|
+int libbpf_nl_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle,
|
|
|
|
+ libbpf_dump_nlmsg_t dump_filter_nlmsg, void *cookie)
|
|
{
|
|
{
|
|
struct {
|
|
struct {
|
|
struct nlmsghdr nlh;
|
|
struct nlmsghdr nlh;
|