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 
30 #include <libnetfilter_log/linux_nfnetlink_log.h>
31 
32 #include <libnfnetlink/libnfnetlink.h>
33 #include <libnetfilter_log/libnetfilter_log.h>
34 
65 {
66  struct nfnl_handle *nfnlh;
67  struct nfnl_subsys_handle *nfnlssh;
68  struct nflog_g_handle *gh_list;
69 };
70 
72 {
73  struct nflog_g_handle *next;
74  struct nflog_handle *h;
75  u_int16_t id;
76 
77  nflog_callback *cb;
78  void *data;
79 };
80 
81 struct nflog_data
82 {
83  struct nfattr **nfa;
84 };
85 
86 int nflog_errno;
87 
88 /***********************************************************************
89  * low level stuff
90  ***********************************************************************/
91 
92 static void del_gh(struct nflog_g_handle *gh)
93 {
94  struct nflog_g_handle *cur_gh, *prev_gh = NULL;
95 
96  for (cur_gh = gh->h->gh_list; cur_gh; cur_gh = cur_gh->next) {
97  if (cur_gh == gh) {
98  if (prev_gh)
99  prev_gh->next = gh->next;
100  else
101  gh->h->gh_list = gh->next;
102  return;
103  }
104  prev_gh = cur_gh;
105  }
106 }
107 
108 static void add_gh(struct nflog_g_handle *gh)
109 {
110  gh->next = gh->h->gh_list;
111  gh->h->gh_list = gh;
112 }
113 
114 static struct nflog_g_handle *find_gh(struct nflog_handle *h, u_int16_t group)
115 {
116  struct nflog_g_handle *gh;
117 
118  for (gh = h->gh_list; gh; gh = gh->next) {
119  if (gh->id == group)
120  return gh;
121  }
122  return NULL;
123 }
124 
125 /* build a NFULNL_MSG_CONFIG message */
126 static int
127 __build_send_cfg_msg(struct nflog_handle *h, u_int8_t command,
128  u_int16_t groupnum, u_int8_t pf)
129 {
130  union {
131  char buf[NFNL_HEADER_LEN
132  +NFA_LENGTH(sizeof(struct nfulnl_msg_config_cmd))];
133  struct nlmsghdr nmh;
134  } u;
135  struct nfulnl_msg_config_cmd cmd;
136 
137  nfnl_fill_hdr(h->nfnlssh, &u.nmh, 0, pf, groupnum,
138  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
139 
140  cmd.command = command;
141  nfnl_addattr_l(&u.nmh, sizeof(u), NFULA_CFG_CMD, &cmd, sizeof(cmd));
142 
143  return nfnl_query(h->nfnlh, &u.nmh);
144 }
145 
146 static int __nflog_rcv_pkt(struct nlmsghdr *nlh, struct nfattr *nfa[],
147  void *data)
148 {
149  struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
150  struct nflog_handle *h = data;
151  u_int16_t group = ntohs(nfmsg->res_id);
152  struct nflog_g_handle *gh = find_gh(h, group);
153  struct nflog_data nfldata;
154 
155  if (!gh)
156  return -ENODEV;
157 
158  if (!gh->cb)
159  return -ENODEV;
160 
161  nfldata.nfa = nfa;
162  return gh->cb(gh, nfmsg, &nfldata, gh->data);
163 }
164 
165 static struct nfnl_callback pkt_cb = {
166  .call = &__nflog_rcv_pkt,
167  .attr_count = NFULA_MAX,
168 };
169 
170 /* public interface */
171 
172 struct nfnl_handle *nflog_nfnlh(struct nflog_handle *h)
173 {
174  return h->nfnlh;
175 }
176 
231 int nflog_fd(struct nflog_handle *h)
232 {
233  return nfnl_fd(nflog_nfnlh(h));
234 }
235 
240 struct nflog_handle *nflog_open_nfnl(struct nfnl_handle *nfnlh)
241 {
242  struct nflog_handle *h;
243  int err;
244 
245  h = malloc(sizeof(*h));
246  if (!h)
247  return NULL;
248 
249  memset(h, 0, sizeof(*h));
250  h->nfnlh = nfnlh;
251 
252  h->nfnlssh = nfnl_subsys_open(h->nfnlh, NFNL_SUBSYS_ULOG,
253  NFULNL_MSG_MAX, 0);
254  if (!h->nfnlssh) {
255  /* FIXME: nflog_errno */
256  goto out_free;
257  }
258 
259  pkt_cb.data = h;
260  err = nfnl_callback_register(h->nfnlssh, NFULNL_MSG_PACKET, &pkt_cb);
261  if (err < 0) {
262  nflog_errno = err;
263  goto out_close;
264  }
265 
266  return h;
267 out_close:
268  nfnl_close(h->nfnlh);
269 out_free:
270  free(h);
271  return NULL;
272 }
273 
290 {
291  struct nfnl_handle *nfnlh;
292  struct nflog_handle *lh;
293 
294  nfnlh = nfnl_open();
295  if (!nfnlh) {
296  /* FIXME: nflog_errno */
297  return NULL;
298  }
299 
300  /* disable netlink sequence tracking by default */
301  nfnl_unset_sequence_tracking(nfnlh);
302 
303  lh = nflog_open_nfnl(nfnlh);
304  if (!lh)
305  nfnl_close(nfnlh);
306 
307  return lh;
308 }
309 
314 int nflog_callback_register(struct nflog_g_handle *gh, nflog_callback *cb,
315  void *data)
316 {
317  gh->data = data;
318  gh->cb = cb;
319 
320  return 0;
321 }
322 
323 int nflog_handle_packet(struct nflog_handle *h, char *buf, int len)
324 {
325  return nfnl_handle_packet(h->nfnlh, buf, len);
326 }
327 
345 int nflog_close(struct nflog_handle *h)
346 {
347  int ret = nfnl_close(h->nfnlh);
348  free(h);
349  return ret;
350 }
351 
362 int nflog_bind_pf(struct nflog_handle *h, u_int16_t pf)
363 {
364  return __build_send_cfg_msg(h, NFULNL_CFG_CMD_PF_BIND, 0, pf);
365 }
366 
367 
376 int nflog_unbind_pf(struct nflog_handle *h, u_int16_t pf)
377 {
378  return __build_send_cfg_msg(h, NFULNL_CFG_CMD_PF_UNBIND, 0, pf);
379 }
380 
397 struct nflog_g_handle *
398 nflog_bind_group(struct nflog_handle *h, u_int16_t num)
399 {
400  struct nflog_g_handle *gh;
401 
402  if (find_gh(h, num))
403  return NULL;
404 
405  gh = malloc(sizeof(*gh));
406  if (!gh)
407  return NULL;
408 
409  memset(gh, 0, sizeof(*gh));
410  gh->h = h;
411  gh->id = num;
412 
413  if (__build_send_cfg_msg(h, NFULNL_CFG_CMD_BIND, num, 0) < 0) {
414  free(gh);
415  return NULL;
416  }
417 
418  add_gh(gh);
419  return gh;
420 }
421 
438 {
439  int ret = __build_send_cfg_msg(gh->h, NFULNL_CFG_CMD_UNBIND, gh->id, 0);
440  if (ret == 0) {
441  del_gh(gh);
442  free(gh);
443  }
444 
445  return ret;
446 }
447 
464  u_int8_t mode, u_int32_t range)
465 {
466  union {
467  char buf[NFNL_HEADER_LEN
468  +NFA_LENGTH(sizeof(struct nfulnl_msg_config_mode))];
469  struct nlmsghdr nmh;
470  } u;
471  struct nfulnl_msg_config_mode params;
472 
473  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
474  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
475 
476  params.copy_range = htonl(range); /* copy_range is short */
477  params.copy_mode = mode;
478  nfnl_addattr_l(&u.nmh, sizeof(u), NFULA_CFG_MODE, &params,
479  sizeof(params));
480 
481  return nfnl_query(gh->h->nfnlh, &u.nmh);
482 }
483 
496 int nflog_set_timeout(struct nflog_g_handle *gh, u_int32_t timeout)
497 {
498  union {
499  char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))];
500  struct nlmsghdr nmh;
501  } u;
502 
503  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
504  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
505 
506  nfnl_addattr32(&u.nmh, sizeof(u), NFULA_CFG_TIMEOUT, htonl(timeout));
507 
508  return nfnl_query(gh->h->nfnlh, &u.nmh);
509 }
510 
521 int nflog_set_qthresh(struct nflog_g_handle *gh, u_int32_t qthresh)
522 {
523  union {
524  char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))];
525  struct nlmsghdr nmh;
526  } u;
527 
528  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
529  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
530 
531  nfnl_addattr32(&u.nmh, sizeof(u), NFULA_CFG_QTHRESH, htonl(qthresh));
532 
533  return nfnl_query(gh->h->nfnlh, &u.nmh);
534 }
535 
550 int nflog_set_nlbufsiz(struct nflog_g_handle *gh, u_int32_t nlbufsiz)
551 {
552  union {
553  char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int32_t))];
554  struct nlmsghdr nmh;
555  } u;
556  int status;
557 
558  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
559  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
560 
561  nfnl_addattr32(&u.nmh, sizeof(u), NFULA_CFG_NLBUFSIZ, htonl(nlbufsiz));
562 
563  status = nfnl_query(gh->h->nfnlh, &u.nmh);
564 
565  /* we try to have space for at least 10 messages in the socket buffer */
566  if (status >= 0)
567  nfnl_rcvbufsiz(gh->h->nfnlh, 10*nlbufsiz);
568 
569  return status;
570 }
571 
584 int nflog_set_flags(struct nflog_g_handle *gh, u_int16_t flags)
585 {
586  union {
587  char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int16_t))];
588  struct nlmsghdr nmh;
589  } u;
590 
591  nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
592  NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);
593 
594  nfnl_addattr16(&u.nmh, sizeof(u), NFULA_CFG_FLAGS, htons(flags));
595 
596  return nfnl_query(gh->h->nfnlh, &u.nmh);
597 }
598 
625 struct nfulnl_msg_packet_hdr *nflog_get_msg_packet_hdr(struct nflog_data *nfad)
626 {
627  return nfnl_get_pointer_to_data(nfad->nfa, NFULA_PACKET_HDR,
628  struct nfulnl_msg_packet_hdr);
629 }
630 
637 u_int16_t nflog_get_hwtype(struct nflog_data *nfad)
638 {
639  return ntohs(nfnl_get_data(nfad->nfa, NFULA_HWTYPE, u_int16_t));
640 }
641 
649 {
650  return ntohs(nfnl_get_data(nfad->nfa, NFULA_HWLEN, u_int16_t));
651 }
652 
660 {
661  return nfnl_get_pointer_to_data(nfad->nfa, NFULA_HWHEADER, char);
662 }
663 
670 u_int32_t nflog_get_nfmark(struct nflog_data *nfad)
671 {
672  return ntohl(nfnl_get_data(nfad->nfa, NFULA_MARK, u_int32_t));
673 }
674 
684 int nflog_get_timestamp(struct nflog_data *nfad, struct timeval *tv)
685 {
686  struct nfulnl_msg_packet_timestamp *uts;
687 
688  uts = nfnl_get_pointer_to_data(nfad->nfa, NFULA_TIMESTAMP,
689  struct nfulnl_msg_packet_timestamp);
690  if (!uts)
691  return -1;
692 
693  tv->tv_sec = __be64_to_cpu(uts->sec);
694  tv->tv_usec = __be64_to_cpu(uts->usec);
695 
696  return 0;
697 }
698 
710 u_int32_t nflog_get_indev(struct nflog_data *nfad)
711 {
712  return ntohl(nfnl_get_data(nfad->nfa, NFULA_IFINDEX_INDEV, u_int32_t));
713 }
714 
723 u_int32_t nflog_get_physindev(struct nflog_data *nfad)
724 {
725  return ntohl(nfnl_get_data(nfad->nfa, NFULA_IFINDEX_PHYSINDEV, u_int32_t));
726 }
727 
736 u_int32_t nflog_get_outdev(struct nflog_data *nfad)
737 {
738  return ntohl(nfnl_get_data(nfad->nfa, NFULA_IFINDEX_OUTDEV, u_int32_t));
739 }
740 
752 u_int32_t nflog_get_physoutdev(struct nflog_data *nfad)
753 {
754  return ntohl(nfnl_get_data(nfad->nfa, NFULA_IFINDEX_PHYSOUTDEV, u_int32_t));
755 }
756 
776 struct nfulnl_msg_packet_hw *nflog_get_packet_hw(struct nflog_data *nfad)
777 {
778  return nfnl_get_pointer_to_data(nfad->nfa, NFULA_HWADDR,
779  struct nfulnl_msg_packet_hw);
780 }
781 
793 int nflog_get_payload(struct nflog_data *nfad, char **data)
794 {
795  *data = nfnl_get_pointer_to_data(nfad->nfa, NFULA_PAYLOAD, char);
796  if (*data)
797  return NFA_PAYLOAD(nfad->nfa[NFULA_PAYLOAD-1]);
798 
799  return -1;
800 }
801 
809 char *nflog_get_prefix(struct nflog_data *nfad)
810 {
811  return nfnl_get_pointer_to_data(nfad->nfa, NFULA_PREFIX, char);
812 }
813 
820 int nflog_get_uid(struct nflog_data *nfad, u_int32_t *uid)
821 {
822  if (!nfnl_attr_present(nfad->nfa, NFULA_UID))
823  return -1;
824 
825  *uid = ntohl(nfnl_get_data(nfad->nfa, NFULA_UID, u_int32_t));
826  return 0;
827 }
828 
835 int nflog_get_gid(struct nflog_data *nfad, u_int32_t *gid)
836 {
837  if (!nfnl_attr_present(nfad->nfa, NFULA_GID))
838  return -1;
839 
840  *gid = ntohl(nfnl_get_data(nfad->nfa, NFULA_GID, u_int32_t));
841  return 0;
842 }
843 
852 int nflog_get_seq(struct nflog_data *nfad, u_int32_t *seq)
853 {
854  if (!nfnl_attr_present(nfad->nfa, NFULA_SEQ))
855  return -1;
856 
857  *seq = ntohl(nfnl_get_data(nfad->nfa, NFULA_SEQ, u_int32_t));
858  return 0;
859 }
860 
869 int nflog_get_seq_global(struct nflog_data *nfad, u_int32_t *seq)
870 {
871  if (!nfnl_attr_present(nfad->nfa, NFULA_SEQ_GLOBAL))
872  return -1;
873 
874  *seq = ntohl(nfnl_get_data(nfad->nfa, NFULA_SEQ_GLOBAL, u_int32_t));
875  return 0;
876 }
877 
882 #define SNPRINTF_FAILURE(ret, rem, offset, len) \
883 do { \
884  if (ret < 0) \
885  return ret; \
886  len += ret; \
887  if (ret > rem) \
888  ret = rem; \
889  offset += ret; \
890  rem -= ret; \
891 } while (0)
892 
922 int nflog_snprintf_xml(char *buf, size_t rem, struct nflog_data *tb, int flags)
923 {
924  struct nfulnl_msg_packet_hdr *ph;
925  struct nfulnl_msg_packet_hw *hwph;
926  u_int32_t mark, ifi;
927  int size, offset = 0, len = 0, ret;
928  char *data;
929 
930  size = snprintf(buf + offset, rem, "<log>");
931  SNPRINTF_FAILURE(size, rem, offset, len);
932 
933  if (flags & NFLOG_XML_TIME) {
934  time_t t;
935  struct tm tm;
936 
937  t = time(NULL);
938  if (localtime_r(&t, &tm) == NULL)
939  return -1;
940 
941  size = snprintf(buf + offset, rem, "<when>");
942  SNPRINTF_FAILURE(size, rem, offset, len);
943 
944  size = snprintf(buf + offset, rem,
945  "<hour>%d</hour>", tm.tm_hour);
946  SNPRINTF_FAILURE(size, rem, offset, len);
947 
948  size = snprintf(buf + offset,
949  rem, "<min>%02d</min>", tm.tm_min);
950  SNPRINTF_FAILURE(size, rem, offset, len);
951 
952  size = snprintf(buf + offset,
953  rem, "<sec>%02d</sec>", tm.tm_sec);
954  SNPRINTF_FAILURE(size, rem, offset, len);
955 
956  size = snprintf(buf + offset, rem, "<wday>%d</wday>",
957  tm.tm_wday + 1);
958  SNPRINTF_FAILURE(size, rem, offset, len);
959 
960  size = snprintf(buf + offset, rem, "<day>%d</day>", tm.tm_mday);
961  SNPRINTF_FAILURE(size, rem, offset, len);
962 
963  size = snprintf(buf + offset, rem, "<month>%d</month>",
964  tm.tm_mon + 1);
965  SNPRINTF_FAILURE(size, rem, offset, len);
966 
967  size = snprintf(buf + offset, rem, "<year>%d</year>",
968  1900 + tm.tm_year);
969  SNPRINTF_FAILURE(size, rem, offset, len);
970 
971  size = snprintf(buf + offset, rem, "</when>");
972  SNPRINTF_FAILURE(size, rem, offset, len);
973  }
974 
975  data = nflog_get_prefix(tb);
976  if (data && (flags & NFLOG_XML_PREFIX)) {
977  size = snprintf(buf + offset, rem, "<prefix>%s</prefix>", data);
978  SNPRINTF_FAILURE(size, rem, offset, len);
979  }
980 
981  ph = nflog_get_msg_packet_hdr(tb);
982  if (ph) {
983  size = snprintf(buf + offset, rem, "<hook>%u</hook>", ph->hook);
984  SNPRINTF_FAILURE(size, rem, offset, len);
985 
986  hwph = nflog_get_packet_hw(tb);
987  if (hwph && (flags & NFLOG_XML_HW)) {
988  int i, hlen = ntohs(hwph->hw_addrlen);
989 
990  size = snprintf(buf + offset, rem, "<hw><proto>%04x"
991  "</proto>",
992  ntohs(ph->hw_protocol));
993  SNPRINTF_FAILURE(size, rem, offset, len);
994 
995  size = snprintf(buf + offset, rem, "<src>");
996  SNPRINTF_FAILURE(size, rem, offset, len);
997 
998  for (i=0; i<hlen; i++) {
999  size = snprintf(buf + offset, rem, "%02x",
1000  hwph->hw_addr[i]);
1001  SNPRINTF_FAILURE(size, rem, offset, len);
1002  }
1003 
1004  size = snprintf(buf + offset, rem, "</src></hw>");
1005  SNPRINTF_FAILURE(size, rem, offset, len);
1006  } else if (flags & NFLOG_XML_HW) {
1007  size = snprintf(buf + offset, rem, "<hw><proto>%04x"
1008  "</proto></hw>",
1009  ntohs(ph->hw_protocol));
1010  SNPRINTF_FAILURE(size, rem, offset, len);
1011  }
1012  }
1013 
1014  mark = nflog_get_nfmark(tb);
1015  if (mark && (flags & NFLOG_XML_MARK)) {
1016  size = snprintf(buf + offset, rem, "<mark>%u</mark>", mark);
1017  SNPRINTF_FAILURE(size, rem, offset, len);
1018  }
1019 
1020  ifi = nflog_get_indev(tb);
1021  if (ifi && (flags & NFLOG_XML_DEV)) {
1022  size = snprintf(buf + offset, rem, "<indev>%u</indev>", ifi);
1023  SNPRINTF_FAILURE(size, rem, offset, len);
1024  }
1025 
1026  ifi = nflog_get_outdev(tb);
1027  if (ifi && (flags & NFLOG_XML_DEV)) {
1028  size = snprintf(buf + offset, rem, "<outdev>%u</outdev>", ifi);
1029  SNPRINTF_FAILURE(size, rem, offset, len);
1030  }
1031 
1032  ifi = nflog_get_physindev(tb);
1033  if (ifi && (flags & NFLOG_XML_PHYSDEV)) {
1034  size = snprintf(buf + offset, rem,
1035  "<physindev>%u</physindev>", ifi);
1036  SNPRINTF_FAILURE(size, rem, offset, len);
1037  }
1038 
1039  ifi = nflog_get_physoutdev(tb);
1040  if (ifi && (flags & NFLOG_XML_PHYSDEV)) {
1041  size = snprintf(buf + offset, rem,
1042  "<physoutdev>%u</physoutdev>", ifi);
1043  SNPRINTF_FAILURE(size, rem, offset, len);
1044  }
1045 
1046  ret = nflog_get_payload(tb, &data);
1047  if (ret >= 0 && (flags & NFLOG_XML_PAYLOAD)) {
1048  int i;
1049 
1050  size = snprintf(buf + offset, rem, "<payload>");
1051  SNPRINTF_FAILURE(size, rem, offset, len);
1052 
1053  for (i=0; i<ret; i++) {
1054  size = snprintf(buf + offset, rem, "%02x",
1055  data[i] & 0xff);
1056  SNPRINTF_FAILURE(size, rem, offset, len);
1057  }
1058 
1059  size = snprintf(buf + offset, rem, "</payload>");
1060  SNPRINTF_FAILURE(size, rem, offset, len);
1061  }
1062 
1063  size = snprintf(buf + offset, rem, "</log>");
1064  SNPRINTF_FAILURE(size, rem, offset, len);
1065 
1066  return len;
1067 }
1068 
int nflog_bind_pf(struct nflog_handle *h, u_int16_t pf)
struct nflog_handle * nflog_open(void)
int nflog_unbind_pf(struct nflog_handle *h, u_int16_t pf)
int nflog_close(struct nflog_handle *h)
int nflog_set_timeout(struct nflog_g_handle *gh, u_int32_t timeout)
int nflog_set_mode(struct nflog_g_handle *gh, u_int8_t mode, u_int32_t range)
int nflog_set_qthresh(struct nflog_g_handle *gh, u_int32_t qthresh)
struct nflog_g_handle * nflog_bind_group(struct nflog_handle *h, u_int16_t num)
int nflog_set_flags(struct nflog_g_handle *gh, u_int16_t flags)
int nflog_fd(struct nflog_handle *h)
int nflog_set_nlbufsiz(struct nflog_g_handle *gh, u_int32_t nlbufsiz)
int nflog_unbind_group(struct nflog_g_handle *gh)
u_int32_t nflog_get_physindev(struct nflog_data *nfad)
u_int32_t nflog_get_nfmark(struct nflog_data *nfad)
int nflog_get_uid(struct nflog_data *nfad, u_int32_t *uid)
struct nfulnl_msg_packet_hw * nflog_get_packet_hw(struct nflog_data *nfad)
int nflog_get_seq_global(struct nflog_data *nfad, u_int32_t *seq)
int nflog_get_seq(struct nflog_data *nfad, u_int32_t *seq)
u_int16_t nflog_get_hwtype(struct nflog_data *nfad)
u_int16_t nflog_get_msg_packet_hwhdrlen(struct nflog_data *nfad)
char * nflog_get_prefix(struct nflog_data *nfad)
int nflog_get_gid(struct nflog_data *nfad, u_int32_t *gid)
struct nfulnl_msg_packet_hdr * nflog_get_msg_packet_hdr(struct nflog_data *nfad)
u_int32_t nflog_get_physoutdev(struct nflog_data *nfad)
u_int32_t nflog_get_indev(struct nflog_data *nfad)
int nflog_get_payload(struct nflog_data *nfad, char **data)
u_int32_t nflog_get_outdev(struct nflog_data *nfad)
int nflog_get_timestamp(struct nflog_data *nfad, struct timeval *tv)
char * nflog_get_msg_packet_hwhdr(struct nflog_data *nfad)
int nflog_snprintf_xml(char *buf, size_t rem, struct nflog_data *tb, int flags)