6 #include <sys/select.h>
8 #include <libmnl/libmnl.h>
14 struct nlmsghdr *nlh = snd_buf;
15 unsigned int seq, portid;
21 nl = mnl_socket_open(NETLINK_NETFILTER);
23 perror(
"mnl_socket_open");
26 if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) {
27 perror(
"mnl_socket_bind");
30 portid = mnl_socket_get_portid(nl);
32 ret = mnl_socket_sendto(nl, snd_buf,
sizeof(snd_buf));
34 perror(
"mnl_socket_recvfrom");
37 printf(
"sent %d\n", ret);
39 ret = mnl_socket_recvfrom(nl, buf,
sizeof(buf));
41 printf(
"ret %d\n", ret);