libnetfilter_log  1.0.1
libnetfilter_log.c
1 /* libnetfilter_log.c: generic library for access to NFLOG
2  *
3  * (C) 2005 by Harald Welte <laforge@gnumonks.org>
4  * (C) 2005, 2008-2010 by Pablo Neira Ayuso <pablo@netfilter.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2
8  * as published by the Free Software Foundation (or any later at your option)
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <string.h>
24 #include <ctype.h>
25 #include <time.h>
26 #include <errno.h>
27 #include <netinet/in.h>
28 #include <sys/socket.h>
29 #include "internal.h"
30 
31 #include <libnetfilter_log/linux_nfnetlink_log.h>
32 
33 #include <libnfnetlink/libnfnetlink.h>
34 #include <libnetfilter_log/libnetfilter_log.h>
35 
66 {
67  struct nfnl_handle *nfnlh;
68  struct nfnl_subsys_handle *nfnlssh;
69  struct nflog_g_handle *gh_list;
70 };
71 
73 {
74  struct nflog_g_handle *next;
75  struct nflog_handle *h;
76  uint16_t id;
77 
78  nflog_callback *cb;
79  void *data;
80 };
81 
82 int nflog_errno;
83 
84 /***********************************************************************
85  * low level stuff
86  ***********************************************************************/
87 
88 static void del_gh(struct nflog_g_handle *gh)
89 {
90  struct nflog_g_handle *cur_gh, *prev_gh = NULL;
91 
92  for (cur_gh = gh->h->gh_list; cur_gh; cur_gh = cur_gh->next) {
93  if (cur_gh == gh) {
94  if (prev_gh)
95  prev_gh->next = gh->next;
96  else
97  gh->h->gh_list = gh->next;
98  return;
99  }
100  prev_gh = cur_gh;
101  }
102 }
103 
104 static void add_gh(struct nflog_g_handle *gh)
105 {
106  gh->next = gh->h->gh_list;
107  gh->h->gh_list = gh;
108 }
109 
110 static struct nflog_g_handle *find_gh(struct nflog_handle *h, uint16_t group)
111 {
112  struct nflog_g_handle *gh;
113 
114  for (gh = h->gh_list; gh; gh = gh->next) {
115  if (gh->id == group)
116  return gh;
117  }
118  return NULL;
119 }
120 
121 /* build a NFULNL_MSG_CONFIG message */
122 static int
123 __build_send_cfg_msg(struct nflog_handle *h, uint8_t command,
124  uint16_t groupnum, uint8_t pf)
125 {
126  union {
127  char buf[NFNL_HEADER_LEN
128  +NFA_LENGTH(sizeof(struct nfulnl_msg_config_cmd))];
129  struct nlmsghdr nmh;
130  } u;
131  struct nfulnl_msg_config_cmd cmd;
132 
133  nfnl_fill_hdr(h->nfnlssh, &u.nmh, 0, pf, groupnum,
134  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
135 
136  cmd.command = command;
137  nfnl_addattr_l(&u.nmh, sizeof(u), NFULA_CFG_CMD, &cmd, sizeof(cmd));
138 
139  return nfnl_query(h->nfnlh, &u.nmh);
140 }
141 
142 static int __nflog_rcv_pkt(struct nlmsghdr *nlh, struct nfattr *nfa[],
143  void *data)
144 {
145  struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
146  struct nflog_handle *h = data;
147  uint16_t group = ntohs(nfmsg->res_id);
148  struct nflog_g_handle *gh = find_gh(h, group);
149  struct nflog_data nfldata;
150 
151  if (!gh)
152  return -ENODEV;
153 
154  if (!gh->cb)
155  return -ENODEV;
156 
157  nfldata.nfa = nfa;
158  return gh->cb(gh, nfmsg, &nfldata, gh->data);
159 }
160 
161 static struct nfnl_callback pkt_cb = {
162  .call = &__nflog_rcv_pkt,
163  .attr_count = NFULA_MAX,
164 };
165 
166 /* public interface */
167 
168 struct nfnl_handle *nflog_nfnlh(struct nflog_handle *h)
169 {
170  return h->nfnlh;
171 }
172 
227 int nflog_fd(struct nflog_handle *h)
228 {
229  return nfnl_fd(nflog_nfnlh(h));
230 }
231 
236 struct nflog_handle *nflog_open_nfnl(struct nfnl_handle *nfnlh)
237 {
238  struct nflog_handle *h;
239  int err;
240 
241  h = malloc(sizeof(*h));
242  if (!h)
243  return NULL;
244 
245  memset(h, 0, sizeof(*h));
246  h->nfnlh = nfnlh;
247 
248  h->nfnlssh = nfnl_subsys_open(h->nfnlh, NFNL_SUBSYS_ULOG,
249  NFULNL_MSG_MAX, 0);
250  if (!h->nfnlssh) {
251  /* FIXME: nflog_errno */
252  goto out_free;
253  }
254 
255  pkt_cb.data = h;
256  err = nfnl_callback_register(h->nfnlssh, NFULNL_MSG_PACKET, &pkt_cb);
257  if (err < 0) {
258  nflog_errno = err;
259  goto out_close;
260  }
261 
262  return h;
263 out_close:
264  nfnl_close(h->nfnlh);
265 out_free:
266  free(h);
267  return NULL;
268 }
269 
286 {
287  struct nfnl_handle *nfnlh;
288  struct nflog_handle *lh;
289 
290  nfnlh = nfnl_open();
291  if (!nfnlh) {
292  /* FIXME: nflog_errno */
293  return NULL;
294  }
295 
296  /* disable netlink sequence tracking by default */
297  nfnl_unset_sequence_tracking(nfnlh);
298 
299  lh = nflog_open_nfnl(nfnlh);
300  if (!lh)
301  nfnl_close(nfnlh);
302 
303  return lh;
304 }
305 
310 int nflog_callback_register(struct nflog_g_handle *gh, nflog_callback *cb,
311  void *data)
312 {
313  gh->data = data;
314  gh->cb = cb;
315 
316  return 0;
317 }
318 
319 int nflog_handle_packet(struct nflog_handle *h, char *buf, int len)
320 {
321  return nfnl_handle_packet(h->nfnlh, buf, len);
322 }
323 
341 int nflog_close(struct nflog_handle *h)
342 {
343  int ret = nfnl_close(h->nfnlh);
344  free(h);
345  return ret;
346 }
347 
358 int nflog_bind_pf(struct nflog_handle *h, uint16_t pf)
359 {
360  return __build_send_cfg_msg(h, NFULNL_CFG_CMD_PF_BIND, 0, pf);
361 }
362 
363 
372 int nflog_unbind_pf(struct nflog_handle *h, uint16_t pf)
373 {
374  return __build_send_cfg_msg(h, NFULNL_CFG_CMD_PF_UNBIND, 0, pf);
375 }
376 
393 struct nflog_g_handle *
394 nflog_bind_group(struct nflog_handle *h, uint16_t num)
395 {
396  struct nflog_g_handle *gh;
397 
398  if (find_gh(h, num))
399  return NULL;
400 
401  gh = malloc(sizeof(*gh));
402  if (!gh)
403  return NULL;
404 
405  memset(gh, 0, sizeof(*gh));
406  gh->h = h;
407  gh->id = num;
408 
409  if (__build_send_cfg_msg(h, NFULNL_CFG_CMD_BIND, num, 0) < 0) {
410  free(gh);
411  return NULL;
412  }
413 
414  add_gh(gh);
415  return gh;
416 }
417 
434 {
435  int ret = __build_send_cfg_msg(gh->h, NFULNL_CFG_CMD_UNBIND, gh->id, 0);
436  if (ret == 0) {
437  del_gh(gh);
438  free(gh);
439  }
440 
441  return ret;
442 }
443 
460  uint8_t mode, uint32_t range)
461 {
462  union {
463  char buf[NFNL_HEADER_LEN
464  +NFA_LENGTH(sizeof(struct nfulnl_msg_config_mode))];
465  struct nlmsghdr nmh;
466  } u;
467  struct nfulnl_msg_config_mode params;
468 
469  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
470  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
471 
472  params.copy_range = htonl(range); /* copy_range is short */
473  params.copy_mode = mode;
474  nfnl_addattr_l(&u.nmh, sizeof(u), NFULA_CFG_MODE, &params,
475  sizeof(params));
476 
477  return nfnl_query(gh->h->nfnlh, &u.nmh);
478 }
479 
492 int nflog_set_timeout(struct nflog_g_handle *gh, uint32_t timeout)
493 {
494  union {
495  char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(uint32_t))];
496  struct nlmsghdr nmh;
497  } u;
498 
499  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
500  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
501 
502  nfnl_addattr32(&u.nmh, sizeof(u), NFULA_CFG_TIMEOUT, htonl(timeout));
503 
504  return nfnl_query(gh->h->nfnlh, &u.nmh);
505 }
506 
517 int nflog_set_qthresh(struct nflog_g_handle *gh, uint32_t qthresh)
518 {
519  union {
520  char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(uint32_t))];
521  struct nlmsghdr nmh;
522  } u;
523 
524  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
525  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
526 
527  nfnl_addattr32(&u.nmh, sizeof(u), NFULA_CFG_QTHRESH, htonl(qthresh));
528 
529  return nfnl_query(gh->h->nfnlh, &u.nmh);
530 }
531 
546 int nflog_set_nlbufsiz(struct nflog_g_handle *gh, uint32_t nlbufsiz)
547 {
548  union {
549  char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(uint32_t))];
550  struct nlmsghdr nmh;
551  } u;
552  int status;
553 
554  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
555  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
556 
557  nfnl_addattr32(&u.nmh, sizeof(u), NFULA_CFG_NLBUFSIZ, htonl(nlbufsiz));
558 
559  status = nfnl_query(gh->h->nfnlh, &u.nmh);
560 
561  /* we try to have space for at least 10 messages in the socket buffer */
562  if (status >= 0)
563  nfnl_rcvbufsiz(gh->h->nfnlh, 10*nlbufsiz);
564 
565  return status;
566 }
567 
580 int nflog_set_flags(struct nflog_g_handle *gh, uint16_t flags)
581 {
582  union {
583  char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(uint16_t))];
584  struct nlmsghdr nmh;
585  } u;
586 
587  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
588  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
589 
590  nfnl_addattr16(&u.nmh, sizeof(u), NFULA_CFG_FLAGS, htons(flags));
591 
592  return nfnl_query(gh->h->nfnlh, &u.nmh);
593 }
594 
621 struct nfulnl_msg_packet_hdr *nflog_get_msg_packet_hdr(struct nflog_data *nfad)
622 {
623  return nfnl_get_pointer_to_data(nfad->nfa, NFULA_PACKET_HDR,
624  struct nfulnl_msg_packet_hdr);
625 }
626 
633 uint16_t nflog_get_hwtype(struct nflog_data *nfad)
634 {
635  return ntohs(nfnl_get_data(nfad->nfa, NFULA_HWTYPE, uint16_t));
636 }
637 
644 uint16_t nflog_get_msg_packet_hwhdrlen(struct nflog_data *nfad)
645 {
646  return ntohs(nfnl_get_data(nfad->nfa, NFULA_HWLEN, uint16_t));
647 }
648 
655 char *nflog_get_msg_packet_hwhdr(struct nflog_data *nfad)
656 {
657  return nfnl_get_pointer_to_data(nfad->nfa, NFULA_HWHEADER, char);
658 }
659 
666 uint32_t nflog_get_nfmark(struct nflog_data *nfad)
667 {
668  return ntohl(nfnl_get_data(nfad->nfa, NFULA_MARK, uint32_t));
669 }
670 
680 int nflog_get_timestamp(struct nflog_data *nfad, struct timeval *tv)
681 {
682  struct nfulnl_msg_packet_timestamp *uts;
683 
684  uts = nfnl_get_pointer_to_data(nfad->nfa, NFULA_TIMESTAMP,
685  struct nfulnl_msg_packet_timestamp);
686  if (!uts)
687  return -1;
688 
689  tv->tv_sec = __be64_to_cpu(uts->sec);
690  tv->tv_usec = __be64_to_cpu(uts->usec);
691 
692  return 0;
693 }
694 
706 uint32_t nflog_get_indev(struct nflog_data *nfad)
707 {
708  return ntohl(nfnl_get_data(nfad->nfa, NFULA_IFINDEX_INDEV, uint32_t));
709 }
710 
719 uint32_t nflog_get_physindev(struct nflog_data *nfad)
720 {
721  return ntohl(nfnl_get_data(nfad->nfa, NFULA_IFINDEX_PHYSINDEV, uint32_t));
722 }
723 
732 uint32_t nflog_get_outdev(struct nflog_data *nfad)
733 {
734  return ntohl(nfnl_get_data(nfad->nfa, NFULA_IFINDEX_OUTDEV, uint32_t));
735 }
736 
748 uint32_t nflog_get_physoutdev(struct nflog_data *nfad)
749 {
750  return ntohl(nfnl_get_data(nfad->nfa, NFULA_IFINDEX_PHYSOUTDEV, uint32_t));
751 }
752 
772 struct nfulnl_msg_packet_hw *nflog_get_packet_hw(struct nflog_data *nfad)
773 {
774  return nfnl_get_pointer_to_data(nfad->nfa, NFULA_HWADDR,
775  struct nfulnl_msg_packet_hw);
776 }
777 
789 int nflog_get_payload(struct nflog_data *nfad, char **data)
790 {
791  *data = nfnl_get_pointer_to_data(nfad->nfa, NFULA_PAYLOAD, char);
792  if (*data)
793  return NFA_PAYLOAD(nfad->nfa[NFULA_PAYLOAD-1]);
794 
795  return -1;
796 }
797 
805 char *nflog_get_prefix(struct nflog_data *nfad)
806 {
807  return nfnl_get_pointer_to_data(nfad->nfa, NFULA_PREFIX, char);
808 }
809 
816 int nflog_get_uid(struct nflog_data *nfad, uint32_t *uid)
817 {
818  if (!nfnl_attr_present(nfad->nfa, NFULA_UID))
819  return -1;
820 
821  *uid = ntohl(nfnl_get_data(nfad->nfa, NFULA_UID, uint32_t));
822  return 0;
823 }
824 
831 int nflog_get_gid(struct nflog_data *nfad, uint32_t *gid)
832 {
833  if (!nfnl_attr_present(nfad->nfa, NFULA_GID))
834  return -1;
835 
836  *gid = ntohl(nfnl_get_data(nfad->nfa, NFULA_GID, uint32_t));
837  return 0;
838 }
839 
848 int nflog_get_seq(struct nflog_data *nfad, uint32_t *seq)
849 {
850  if (!nfnl_attr_present(nfad->nfa, NFULA_SEQ))
851  return -1;
852 
853  *seq = ntohl(nfnl_get_data(nfad->nfa, NFULA_SEQ, uint32_t));
854  return 0;
855 }
856 
865 int nflog_get_seq_global(struct nflog_data *nfad, uint32_t *seq)
866 {
867  if (!nfnl_attr_present(nfad->nfa, NFULA_SEQ_GLOBAL))
868  return -1;
869 
870  *seq = ntohl(nfnl_get_data(nfad->nfa, NFULA_SEQ_GLOBAL, uint32_t));
871  return 0;
872 }
873 
878 #define SNPRINTF_FAILURE(ret, rem, offset, len) \
879 do { \
880  if (ret < 0) \
881  return ret; \
882  len += ret; \
883  if (ret > rem) \
884  ret = rem; \
885  offset += ret; \
886  rem -= ret; \
887 } while (0)
888 
918 int nflog_snprintf_xml(char *buf, size_t rem, struct nflog_data *tb, int flags)
919 {
920  struct nfulnl_msg_packet_hdr *ph;
921  struct nfulnl_msg_packet_hw *hwph;
922  uint32_t mark, ifi;
923  int size, offset = 0, len = 0, ret;
924  char *data;
925 
926  size = snprintf(buf + offset, rem, "<log>");
927  SNPRINTF_FAILURE(size, rem, offset, len);
928 
929  if (flags & NFLOG_XML_TIME) {
930  time_t t;
931  struct tm tm;
932 
933  t = time(NULL);
934  if (localtime_r(&t, &tm) == NULL)
935  return -1;
936 
937  size = snprintf(buf + offset, rem, "<when>");
938  SNPRINTF_FAILURE(size, rem, offset, len);
939 
940  size = snprintf(buf + offset, rem,
941  "<hour>%d</hour>", tm.tm_hour);
942  SNPRINTF_FAILURE(size, rem, offset, len);
943 
944  size = snprintf(buf + offset,
945  rem, "<min>%02d</min>", tm.tm_min);
946  SNPRINTF_FAILURE(size, rem, offset, len);
947 
948  size = snprintf(buf + offset,
949  rem, "<sec>%02d</sec>", tm.tm_sec);
950  SNPRINTF_FAILURE(size, rem, offset, len);
951 
952  size = snprintf(buf + offset, rem, "<wday>%d</wday>",
953  tm.tm_wday + 1);
954  SNPRINTF_FAILURE(size, rem, offset, len);
955 
956  size = snprintf(buf + offset, rem, "<day>%d</day>", tm.tm_mday);
957  SNPRINTF_FAILURE(size, rem, offset, len);
958 
959  size = snprintf(buf + offset, rem, "<month>%d</month>",
960  tm.tm_mon + 1);
961  SNPRINTF_FAILURE(size, rem, offset, len);
962 
963  size = snprintf(buf + offset, rem, "<year>%d</year>",
964  1900 + tm.tm_year);
965  SNPRINTF_FAILURE(size, rem, offset, len);
966 
967  size = snprintf(buf + offset, rem, "</when>");
968  SNPRINTF_FAILURE(size, rem, offset, len);
969  }
970 
971  data = nflog_get_prefix(tb);
972  if (data && (flags & NFLOG_XML_PREFIX)) {
973  size = snprintf(buf + offset, rem, "<prefix>%s</prefix>", data);
974  SNPRINTF_FAILURE(size, rem, offset, len);
975  }
976 
977  ph = nflog_get_msg_packet_hdr(tb);
978  if (ph) {
979  size = snprintf(buf + offset, rem, "<hook>%u</hook>", ph->hook);
980  SNPRINTF_FAILURE(size, rem, offset, len);
981 
982  hwph = nflog_get_packet_hw(tb);
983  if (hwph && (flags & NFLOG_XML_HW)) {
984  int i, hlen = ntohs(hwph->hw_addrlen);
985 
986  size = snprintf(buf + offset, rem, "<hw><proto>%04x"
987  "</proto>",
988  ntohs(ph->hw_protocol));
989  SNPRINTF_FAILURE(size, rem, offset, len);
990 
991  size = snprintf(buf + offset, rem, "<src>");
992  SNPRINTF_FAILURE(size, rem, offset, len);
993 
994  for (i=0; i<hlen; i++) {
995  size = snprintf(buf + offset, rem, "%02x",
996  hwph->hw_addr[i]);
997  SNPRINTF_FAILURE(size, rem, offset, len);
998  }
999 
1000  size = snprintf(buf + offset, rem, "</src></hw>");
1001  SNPRINTF_FAILURE(size, rem, offset, len);
1002  } else if (flags & NFLOG_XML_HW) {
1003  size = snprintf(buf + offset, rem, "<hw><proto>%04x"
1004  "</proto></hw>",
1005  ntohs(ph->hw_protocol));
1006  SNPRINTF_FAILURE(size, rem, offset, len);
1007  }
1008  }
1009 
1010  mark = nflog_get_nfmark(tb);
1011  if (mark && (flags & NFLOG_XML_MARK)) {
1012  size = snprintf(buf + offset, rem, "<mark>%u</mark>", mark);
1013  SNPRINTF_FAILURE(size, rem, offset, len);
1014  }
1015 
1016  ifi = nflog_get_indev(tb);
1017  if (ifi && (flags & NFLOG_XML_DEV)) {
1018  size = snprintf(buf + offset, rem, "<indev>%u</indev>", ifi);
1019  SNPRINTF_FAILURE(size, rem, offset, len);
1020  }
1021 
1022  ifi = nflog_get_outdev(tb);
1023  if (ifi && (flags & NFLOG_XML_DEV)) {
1024  size = snprintf(buf + offset, rem, "<outdev>%u</outdev>", ifi);
1025  SNPRINTF_FAILURE(size, rem, offset, len);
1026  }
1027 
1028  ifi = nflog_get_physindev(tb);
1029  if (ifi && (flags & NFLOG_XML_PHYSDEV)) {
1030  size = snprintf(buf + offset, rem,
1031  "<physindev>%u</physindev>", ifi);
1032  SNPRINTF_FAILURE(size, rem, offset, len);
1033  }
1034 
1035  ifi = nflog_get_physoutdev(tb);
1036  if (ifi && (flags & NFLOG_XML_PHYSDEV)) {
1037  size = snprintf(buf + offset, rem,
1038  "<physoutdev>%u</physoutdev>", ifi);
1039  SNPRINTF_FAILURE(size, rem, offset, len);
1040  }
1041 
1042  ret = nflog_get_payload(tb, &data);
1043  if (ret >= 0 && (flags & NFLOG_XML_PAYLOAD)) {
1044  int i;
1045 
1046  size = snprintf(buf + offset, rem, "<payload>");
1047  SNPRINTF_FAILURE(size, rem, offset, len);
1048 
1049  for (i=0; i<ret; i++) {
1050  size = snprintf(buf + offset, rem, "%02x",
1051  data[i] & 0xff);
1052  SNPRINTF_FAILURE(size, rem, offset, len);
1053  }
1054 
1055  size = snprintf(buf + offset, rem, "</payload>");
1056  SNPRINTF_FAILURE(size, rem, offset, len);
1057  }
1058 
1059  size = snprintf(buf + offset, rem, "</log>");
1060  SNPRINTF_FAILURE(size, rem, offset, len);
1061 
1062  return len;
1063 }
1064 
uint32_t nflog_get_outdev(struct nflog_data *nfad)
int nflog_get_timestamp(struct nflog_data *nfad, struct timeval *tv)
uint16_t nflog_get_hwtype(struct nflog_data *nfad)
int nflog_get_seq(struct nflog_data *nfad, uint32_t *seq)
struct nflog_handle * nflog_open(void)
int nflog_get_gid(struct nflog_data *nfad, uint32_t *gid)
int nflog_set_flags(struct nflog_g_handle *gh, uint16_t flags)
char * nflog_get_msg_packet_hwhdr(struct nflog_data *nfad)
int nflog_set_mode(struct nflog_g_handle *gh, uint8_t mode, uint32_t range)
uint32_t nflog_get_physoutdev(struct nflog_data *nfad)
int nflog_get_payload(struct nflog_data *nfad, char **data)
int nflog_set_timeout(struct nflog_g_handle *gh, uint32_t timeout)
int nflog_set_nlbufsiz(struct nflog_g_handle *gh, uint32_t nlbufsiz)
uint32_t nflog_get_indev(struct nflog_data *nfad)
int nflog_set_qthresh(struct nflog_g_handle *gh, uint32_t qthresh)
struct nfulnl_msg_packet_hw * nflog_get_packet_hw(struct nflog_data *nfad)
int nflog_unbind_pf(struct nflog_handle *h, uint16_t pf)
uint32_t nflog_get_nfmark(struct nflog_data *nfad)
struct nflog_g_handle * nflog_bind_group(struct nflog_handle *h, uint16_t num)
int nflog_get_seq_global(struct nflog_data *nfad, uint32_t *seq)
uint16_t nflog_get_msg_packet_hwhdrlen(struct nflog_data *nfad)
int nflog_bind_pf(struct nflog_handle *h, uint16_t pf)
int nflog_unbind_group(struct nflog_g_handle *gh)
int nflog_close(struct nflog_handle *h)
int nflog_get_uid(struct nflog_data *nfad, uint32_t *uid)
char * nflog_get_prefix(struct nflog_data *nfad)
int nflog_snprintf_xml(char *buf, size_t rem, struct nflog_data *tb, int flags)
int nflog_fd(struct nflog_handle *h)
uint32_t nflog_get_physindev(struct nflog_data *nfad)
struct nfulnl_msg_packet_hdr * nflog_get_msg_packet_hdr(struct nflog_data *nfad)