4 * Copyright (C) 2012 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
9 * Id: ip_log.c,v 2.75.2.19 2007/09/09 11:32:06 darrenr Exp $
11 #include <sys/param.h>
12 #if defined(KERNEL) || defined(_KERNEL)
18 #if defined(__FreeBSD__) && !defined(_KERNEL)
19 # include <osreldate.h>
22 # if defined(sun) && defined(__SVR4)
28 #include <sys/errno.h>
29 #include <sys/types.h>
42 #if defined(__FreeBSD__) && defined(_KERNEL)
43 # include <sys/fcntl.h>
44 # include <sys/filio.h>
46 # include <sys/ioctl.h>
50 # include <sys/systm.h>
51 # if (defined(NetBSD) && (__NetBSD_Version__ >= 104000000))
52 # include <sys/proc.h>
55 # if defined(NetBSD) || defined(__FreeBSD__)
56 # include <sys/dirent.h>
57 # include <sys/mbuf.h>
58 # include <sys/select.h>
60 # if defined(__FreeBSD__)
61 # include <sys/selinfo.h>
63 #if SOLARIS && defined(_KERNEL)
64 # include <sys/filio.h>
65 # include <sys/cred.h>
67 # include <sys/sunddi.h>
68 # include <sys/ksynch.h>
69 # include <sys/kmem.h>
70 # include <sys/mkdev.h>
71 # include <sys/dditypes.h>
72 # include <sys/cmn_err.h>
73 #endif /* SOLARIS && _KERNEL */
74 # include <sys/protosw.h>
75 #include <sys/socket.h>
81 #if defined(__FreeBSD__)
82 # include <net/if_var.h>
84 #include <netinet/in.h>
85 # include <netinet/in_var.h>
86 #include <netinet/in_systm.h>
87 #include <netinet/ip.h>
88 #include <netinet/tcp.h>
89 #include <netinet/udp.h>
90 #include <netinet/ip_icmp.h>
92 # include <netinet/icmp6.h>
94 # include <netinet/ip_var.h>
98 #include "netinet/ip_compat.h"
99 #include <netinet/tcpip.h>
100 #include "netinet/ip_fil.h"
101 #include "netinet/ip_nat.h"
102 #include "netinet/ip_frag.h"
103 #include "netinet/ip_state.h"
104 #include "netinet/ip_auth.h"
105 #if defined(__FreeBSD__) || defined(__NetBSD__)
106 # include <sys/malloc.h>
108 /* END OF INCLUDES */
112 # if defined(IPL_SELECT)
113 # include <machine/sys/user.h>
114 # include <sys/kthread_iface.h>
115 # define READ_COLLISION 0x001
117 # endif /* IPL_SELECT */
119 typedef struct ipf_log_softc_s {
120 ipfmutex_t ipl_mutex[IPL_LOGSIZE];
121 # if SOLARIS && defined(_KERNEL)
122 kcondvar_t ipl_wait[IPL_LOGSIZE];
124 iplog_t **iplh[IPL_LOGSIZE];
125 iplog_t *iplt[IPL_LOGSIZE];
126 iplog_t *ipll[IPL_LOGSIZE];
127 u_long ipl_logfail[IPL_LOGSIZE];
128 u_long ipl_logok[IPL_LOGSIZE];
129 fr_info_t ipl_crc[IPL_LOGSIZE];
130 u_32_t ipl_counter[IPL_LOGSIZE];
135 int ipl_used[IPL_LOGSIZE];
136 int ipl_magic[IPL_LOGSIZE];
137 ipftuneable_t *ipf_log_tune;
138 int ipl_readers[IPL_LOGSIZE];
141 static int magic[IPL_LOGSIZE] = { IPL_MAGIC, IPL_MAGIC_NAT, IPL_MAGIC_STATE,
142 IPL_MAGIC, IPL_MAGIC, IPL_MAGIC,
143 IPL_MAGIC, IPL_MAGIC };
145 static ipftuneable_t ipf_log_tuneables[] = {
147 { { (void *)offsetof(ipf_log_softc_t, ipl_suppress) },
148 "log_suppress", 0, 1,
149 stsizeof(ipf_log_softc_t, ipl_suppress),
151 { { (void *)offsetof(ipf_log_softc_t, ipl_logall) },
153 stsizeof(ipf_log_softc_t, ipl_logall),
155 { { (void *)offsetof(ipf_log_softc_t, ipl_logsize) },
156 "log_size", 0, 0x80000,
157 stsizeof(ipf_log_softc_t, ipl_logsize),
159 { { NULL }, NULL, 0, 0,
173 ipf_log_main_unload()
178 /* ------------------------------------------------------------------------ */
179 /* Function: ipf_log_soft_create */
180 /* Returns: void * - NULL = failure, else pointer to log context data */
181 /* Parameters: softc(I) - pointer to soft context main structure */
183 /* Initialise log buffers & pointers. Also iniialised the CRC to a local */
184 /* secret for use in calculating the "last log checksum". */
185 /* ------------------------------------------------------------------------ */
187 ipf_log_soft_create(softc)
188 ipf_main_softc_t *softc;
190 ipf_log_softc_t *softl;
193 KMALLOC(softl, ipf_log_softc_t *);
197 bzero((char *)softl, sizeof(*softl));
198 bcopy((char *)magic, (char *)softl->ipl_magic, sizeof(magic));
200 softl->ipf_log_tune = ipf_tune_array_copy(softl,
201 sizeof(ipf_log_tuneables),
203 if (softl->ipf_log_tune == NULL) {
204 ipf_log_soft_destroy(softc, softl);
207 if (ipf_tune_array_link(softc, softl->ipf_log_tune) == -1) {
208 ipf_log_soft_destroy(softc, softl);
212 for (i = IPL_LOGMAX; i >= 0; i--) {
213 MUTEX_INIT(&softl->ipl_mutex[i], "ipf log mutex");
216 softl->ipl_suppress = 1;
217 softl->ipl_logall = 0;
218 softl->ipl_log_init = 0;
219 softl->ipl_logsize = IPFILTER_LOGSIZE;
224 /* ------------------------------------------------------------------------ */
225 /* Function: ipf_log_soft_init */
226 /* Returns: int - 0 == success (always returned) */
227 /* Parameters: softc(I) - pointer to soft context main structure */
229 /* Initialise log buffers & pointers. Also iniialised the CRC to a local */
230 /* secret for use in calculating the "last log checksum". */
231 /* ------------------------------------------------------------------------ */
233 ipf_log_soft_init(softc, arg)
234 ipf_main_softc_t *softc;
237 ipf_log_softc_t *softl = arg;
240 for (i = IPL_LOGMAX; i >= 0; i--) {
241 softl->iplt[i] = NULL;
242 softl->ipll[i] = NULL;
243 softl->iplh[i] = &softl->iplt[i];
244 bzero((char *)&softl->ipl_crc[i], sizeof(softl->ipl_crc[i]));
246 softl->iplog_ss[i].read_waiter = 0;
247 softl->iplog_ss[i].state = 0;
252 softl->ipl_log_init = 1;
258 /* ------------------------------------------------------------------------ */
259 /* Function: ipf_log_soft_fini */
260 /* Parameters: softc(I) - pointer to soft context main structure */
261 /* arg(I) - pointer to log context structure */
263 /* Clean up any log data that has accumulated without being read. */
264 /* ------------------------------------------------------------------------ */
266 ipf_log_soft_fini(softc, arg)
267 ipf_main_softc_t *softc;
270 ipf_log_softc_t *softl = arg;
273 if (softl->ipl_log_init == 0)
276 softl->ipl_log_init = 0;
278 for (i = IPL_LOGMAX; i >= 0; i--) {
279 (void) ipf_log_clear(softc, i);
282 * This is a busy-wait loop so as to avoid yet another lock
285 MUTEX_ENTER(&softl->ipl_mutex[i]);
286 while (softl->ipl_readers[i] > 0) {
287 # if SOLARIS && defined(_KERNEL)
288 cv_broadcast(&softl->ipl_wait[i]);
289 MUTEX_EXIT(&softl->ipl_mutex[i]);
291 pollwakeup(&softc->ipf_poll_head[i], POLLRDNORM);
293 MUTEX_EXIT(&softl->ipl_mutex[i]);
294 WAKEUP(softl->iplh, i);
297 MUTEX_ENTER(&softl->ipl_mutex[i]);
299 MUTEX_EXIT(&softl->ipl_mutex[i]);
306 /* ------------------------------------------------------------------------ */
307 /* Function: ipf_log_soft_destroy */
308 /* Parameters: softc(I) - pointer to soft context main structure */
309 /* arg(I) - pointer to log context structure */
311 /* When this function is called, it is expected that there are no longer */
312 /* any threads active in the reading code path or the logging code path. */
313 /* ------------------------------------------------------------------------ */
315 ipf_log_soft_destroy(softc, arg)
316 ipf_main_softc_t *softc;
319 ipf_log_softc_t *softl = arg;
322 for (i = IPL_LOGMAX; i >= 0; i--) {
323 # if SOLARIS && defined(_KERNEL)
324 cv_destroy(&softl->ipl_wait[i]);
326 MUTEX_DESTROY(&softl->ipl_mutex[i]);
329 if (softl->ipf_log_tune != NULL) {
330 ipf_tune_array_unlink(softc, softl->ipf_log_tune);
331 KFREES(softl->ipf_log_tune, sizeof(ipf_log_tuneables));
332 softl->ipf_log_tune = NULL;
339 /* ------------------------------------------------------------------------ */
340 /* Function: ipf_log_pkt */
341 /* Returns: int - 0 == success, -1 == failure */
342 /* Parameters: fin(I) - pointer to packet information */
343 /* flags(I) - flags from filter rules */
345 /* Create a log record for a packet given that it has been triggered by a */
346 /* rule (or the default setting). Calculate the transport protocol header */
347 /* size using predetermined size of a couple of popular protocols and thus */
348 /* how much data to copy into the log, including part of the data body if */
350 /* ------------------------------------------------------------------------ */
352 ipf_log_pkt(fin, flags)
356 ipf_main_softc_t *softc = fin->fin_main_soft;
357 ipf_log_softc_t *softl = softc->ipf_log_soft;
358 register size_t hlen;
365 # if SOLARIS && defined(_KERNEL) && !defined(FW_HOOKS)
369 # endif /* SOLARIS */
375 ipfl.fl_nattag.ipt_num[0] = 0;
377 hlen = (char *)fin->fin_dp - (char *)fin->fin_ip;
380 * calculate header size.
382 if (fin->fin_off == 0) {
383 p = fin->fin_fi.fi_p;
384 if (p == IPPROTO_TCP)
385 hlen += MIN(sizeof(tcphdr_t), fin->fin_dlen);
386 else if (p == IPPROTO_UDP)
387 hlen += MIN(sizeof(udphdr_t), fin->fin_dlen);
388 else if (p == IPPROTO_ICMP) {
391 icmp = (struct icmp *)fin->fin_dp;
394 * For ICMP, if the packet is an error packet, also
395 * include the information about the packet which
398 switch (icmp->icmp_type)
401 case ICMP_SOURCEQUENCH :
404 case ICMP_PARAMPROB :
405 hlen += MIN(sizeof(struct icmp) + 8,
409 hlen += MIN(sizeof(struct icmp),
415 else if (p == IPPROTO_ICMPV6) {
416 struct icmp6_hdr *icmp;
418 icmp = (struct icmp6_hdr *)fin->fin_dp;
421 * For ICMPV6, if the packet is an error packet, also
422 * include the information about the packet which
425 if (icmp->icmp6_type < 128) {
426 hlen += MIN(sizeof(struct icmp6_hdr) + 8,
429 hlen += MIN(sizeof(struct icmp6_hdr),
436 * Get the interface number and name to which this packet is
437 * currently associated.
439 # if SOLARIS && defined(_KERNEL)
440 # if !defined(FW_HOOKS)
441 ipfl.fl_unit = (u_int)ifp->qf_ppa;
443 COPYIFNAME(fin->fin_v, ifp, ipfl.fl_ifname);
445 # if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \
447 COPYIFNAME(fin->fin_v, ifp, ipfl.fl_ifname);
449 ipfl.fl_unit = (u_int)ifp->if_unit;
450 # if defined(_KERNEL)
451 if ((ipfl.fl_ifname[0] = ifp->if_name[0]))
452 if ((ipfl.fl_ifname[1] = ifp->if_name[1]))
453 if ((ipfl.fl_ifname[2] = ifp->if_name[2]))
454 ipfl.fl_ifname[3] = ifp->if_name[3];
456 (void) strncpy(ipfl.fl_ifname, IFNAME(ifp), sizeof(ipfl.fl_ifname));
457 ipfl.fl_ifname[sizeof(ipfl.fl_ifname) - 1] = '\0';
460 # endif /* __hpux || SOLARIS */
461 mlen = fin->fin_plen - hlen;
462 if (!softl->ipl_logall) {
463 mlen = (flags & FR_LOGBODY) ? MIN(mlen, 128) : 0;
464 } else if ((flags & FR_LOGBODY) == 0) {
469 ipfl.fl_plen = (u_char)mlen;
470 ipfl.fl_hlen = (u_char)hlen;
471 ipfl.fl_rule = fin->fin_rule;
472 (void) strncpy(ipfl.fl_group, fin->fin_group, FR_GROUPLEN);
473 if (fin->fin_fr != NULL) {
474 ipfl.fl_loglevel = fin->fin_fr->fr_loglevel;
475 ipfl.fl_logtag = fin->fin_fr->fr_logtag;
477 ipfl.fl_loglevel = 0xffff;
478 ipfl.fl_logtag = FR_NOLOGTAG;
480 if (fin->fin_nattag != NULL)
481 bcopy(fin->fin_nattag, (void *)&ipfl.fl_nattag,
482 sizeof(ipfl.fl_nattag));
483 ipfl.fl_flags = flags;
484 ipfl.fl_breason = (fin->fin_reason & 0xff);
485 ipfl.fl_dir = fin->fin_out;
486 ipfl.fl_lflags = fin->fin_flx;
487 ipfl.fl_family = fin->fin_family;
488 ptrs[0] = (void *)&ipfl;
489 sizes[0] = sizeof(ipfl);
491 # if SOLARIS && defined(_KERNEL)
493 * Are we copied from the mblk or an aligned array ?
495 if (fin->fin_ip == (ip_t *)m->b_rptr) {
497 sizes[1] = hlen + mlen;
500 ptrs[1] = fin->fin_ip;
501 sizes[1] = hlen + mlen;
506 sizes[1] = hlen + mlen;
508 # endif /* SOLARIS */
509 return ipf_log_items(softc, IPL_LOGIPF, fin, ptrs, sizes, types, 2);
513 /* ------------------------------------------------------------------------ */
514 /* Function: ipf_log_items */
515 /* Returns: int - 0 == success, -1 == failure */
516 /* Parameters: softc(I) - pointer to main soft context */
517 /* unit(I) - device we are reading from */
518 /* fin(I) - pointer to packet information */
519 /* items(I) - array of pointers to log data */
520 /* itemsz(I) - array of size of valid memory pointed to */
521 /* types(I) - type of data pointed to by items pointers */
522 /* cnt(I) - number of elements in arrays items/itemsz/types */
524 /* Takes an array of parameters and constructs one record to include the */
525 /* miscellaneous packet information, as well as packet data, for reading */
526 /* from the log device. */
527 /* ------------------------------------------------------------------------ */
529 ipf_log_items(softc, unit, fin, items, itemsz, types, cnt)
530 ipf_main_softc_t *softc;
537 ipf_log_softc_t *softl = softc->ipf_log_soft;
545 * Get the total amount of data to be logged.
547 for (i = 0, len = sizeof(iplog_t); i < cnt; i++)
551 MUTEX_ENTER(&softl->ipl_mutex[unit]);
552 softl->ipl_counter[unit]++;
554 * check that we have space to record this information and can
555 * allocate that much.
557 if ((softl->ipl_used[unit] + len) > softl->ipl_logsize) {
558 softl->ipl_logfail[unit]++;
559 MUTEX_EXIT(&softl->ipl_mutex[unit]);
563 KMALLOCS(buf, caddr_t, len);
565 softl->ipl_logfail[unit]++;
566 MUTEX_EXIT(&softl->ipl_mutex[unit]);
569 ipl = (iplog_t *)buf;
570 ipl->ipl_magic = softl->ipl_magic[unit];
572 ipl->ipl_seqnum = softl->ipl_counter[unit];
573 ipl->ipl_next = NULL;
574 ipl->ipl_dsize = len;
576 GETKTIME(&ipl->ipl_sec);
583 * Loop through all the items to be logged, copying each one to the
584 * buffer. Use bcopy for normal data or the mb_t copyout routine.
586 for (i = 0, ptr = buf + sizeof(*ipl); i < cnt; i++) {
588 bcopy(items[i], ptr, itemsz[i]);
589 } else if (types[i] == 1) {
590 COPYDATA(items[i], 0, itemsz[i], ptr);
595 * Check to see if this log record has a CRC which matches the last
596 * record logged. If it does, just up the count on the previous one
597 * rather than create a new one.
599 if (softl->ipl_suppress) {
600 if ((fin != NULL) && (fin->fin_off == 0)) {
601 if ((softl->ipll[unit] != NULL) &&
602 (fin->fin_crc == softl->ipl_crc[unit].fin_crc) &&
603 bcmp((char *)fin, (char *)&softl->ipl_crc[unit],
605 softl->ipll[unit]->ipl_count++;
606 MUTEX_EXIT(&softl->ipl_mutex[unit]);
611 bcopy((char *)fin, (char *)&softl->ipl_crc[unit],
613 softl->ipl_crc[unit].fin_crc = fin->fin_crc;
615 bzero((char *)&softl->ipl_crc[unit], FI_CSIZE);
619 * advance the log pointer to the next empty record and deduct the
620 * amount of space we're going to use.
622 softl->ipl_logok[unit]++;
623 softl->ipll[unit] = ipl;
624 *softl->iplh[unit] = ipl;
625 softl->iplh[unit] = &ipl->ipl_next;
626 softl->ipl_used[unit] += len;
629 * Now that the log record has been completed and added to the queue,
630 * wake up any listeners who may want to read it.
632 # if SOLARIS && defined(_KERNEL)
633 cv_signal(&softl->ipl_wait[unit]);
634 MUTEX_EXIT(&softl->ipl_mutex[unit]);
635 pollwakeup(&softc->ipf_poll_head[unit], POLLRDNORM);
637 MUTEX_EXIT(&softl->ipl_mutex[unit]);
638 WAKEUP(softl->iplh, unit);
643 iplog_input_ready(unit);
649 /* ------------------------------------------------------------------------ */
650 /* Function: ipf_log_read */
651 /* Returns: int - 0 == success, else error value. */
652 /* Parameters: softc(I) - pointer to main soft context */
653 /* unit(I) - device we are reading from */
654 /* uio(O) - pointer to information about where to store data */
656 /* Called to handle a read on an IPFilter device. Returns only complete */
657 /* log messages - will not partially copy a log record out to userland. */
659 /* NOTE: This function will block and wait for a signal to return data if */
660 /* there is none present. Asynchronous I/O is not implemented. */
661 /* ------------------------------------------------------------------------ */
663 ipf_log_read(softc, unit, uio)
664 ipf_main_softc_t *softc;
668 ipf_log_softc_t *softl = softc->ipf_log_soft;
674 if (softl->ipl_log_init == 0) {
680 * Sanity checks. Make sure the minor # is valid and we're copying
681 * a valid chunk of data.
683 if (IPL_LOGMAX < unit) {
687 if (uio->uio_resid == 0)
690 if (uio->uio_resid < sizeof(iplog_t)) {
694 if (uio->uio_resid > softl->ipl_logsize) {
700 * Lock the log so we can snapshot the variables. Wait for a signal
701 * if the log is empty.
704 MUTEX_ENTER(&softl->ipl_mutex[unit]);
705 softl->ipl_readers[unit]++;
707 while (softl->ipl_log_init == 1 && softl->iplt[unit] == NULL) {
708 # if SOLARIS && defined(_KERNEL)
709 if (!cv_wait_sig(&softl->ipl_wait[unit],
710 &softl->ipl_mutex[unit].ipf_lk)) {
711 softl->ipl_readers[unit]--;
712 MUTEX_EXIT(&softl->ipl_mutex[unit]);
717 MUTEX_EXIT(&softl->ipl_mutex[unit]);
719 error = SLEEP(unit + softl->iplh, "ipl sleep");
721 MUTEX_ENTER(&softl->ipl_mutex[unit]);
723 softl->ipl_readers[unit]--;
724 MUTEX_EXIT(&softl->ipl_mutex[unit]);
728 # endif /* SOLARIS */
730 if (softl->ipl_log_init != 1) {
731 softl->ipl_readers[unit]--;
732 MUTEX_EXIT(&softl->ipl_mutex[unit]);
738 uio->uio_rw = UIO_READ;
741 for (copied = 0; (ipl = softl->iplt[unit]) != NULL; copied += dlen) {
742 dlen = ipl->ipl_dsize;
743 if (dlen > uio->uio_resid)
746 * Don't hold the mutex over the uiomove call.
748 softl->iplt[unit] = ipl->ipl_next;
749 softl->ipl_used[unit] -= dlen;
750 MUTEX_EXIT(&softl->ipl_mutex[unit]);
752 error = UIOMOVE(ipl, dlen, UIO_READ, uio);
755 MUTEX_ENTER(&softl->ipl_mutex[unit]);
757 ipl->ipl_next = softl->iplt[unit];
758 softl->iplt[unit] = ipl;
759 softl->ipl_used[unit] += dlen;
762 MUTEX_ENTER(&softl->ipl_mutex[unit]);
763 KFREES((caddr_t)ipl, dlen);
766 if (!softl->iplt[unit]) {
767 softl->ipl_used[unit] = 0;
768 softl->iplh[unit] = &softl->iplt[unit];
769 softl->ipll[unit] = NULL;
772 softl->ipl_readers[unit]--;
773 MUTEX_EXIT(&softl->ipl_mutex[unit]);
779 /* ------------------------------------------------------------------------ */
780 /* Function: ipf_log_clear */
781 /* Returns: int - number of log bytes cleared. */
782 /* Parameters: softc(I) - pointer to main soft context */
783 /* unit(I) - device we are reading from */
785 /* Deletes all queued up log records for a given output device. */
786 /* ------------------------------------------------------------------------ */
788 ipf_log_clear(softc, unit)
789 ipf_main_softc_t *softc;
792 ipf_log_softc_t *softl = softc->ipf_log_soft;
798 MUTEX_ENTER(&softl->ipl_mutex[unit]);
799 while ((ipl = softl->iplt[unit]) != NULL) {
800 softl->iplt[unit] = ipl->ipl_next;
801 KFREES((caddr_t)ipl, ipl->ipl_dsize);
803 softl->iplh[unit] = &softl->iplt[unit];
804 softl->ipll[unit] = NULL;
805 used = softl->ipl_used[unit];
806 softl->ipl_used[unit] = 0;
807 bzero((char *)&softl->ipl_crc[unit], FI_CSIZE);
808 MUTEX_EXIT(&softl->ipl_mutex[unit]);
814 /* ------------------------------------------------------------------------ */
815 /* Function: ipf_log_canread */
816 /* Returns: int - 0 == no data to read, 1 = data present */
817 /* Parameters: softc(I) - pointer to main soft context */
818 /* unit(I) - device we are reading from */
820 /* Returns an indication of whether or not there is data present in the */
821 /* current buffer for the selected ipf device. */
822 /* ------------------------------------------------------------------------ */
824 ipf_log_canread(softc, unit)
825 ipf_main_softc_t *softc;
828 ipf_log_softc_t *softl = softc->ipf_log_soft;
830 return softl->iplt[unit] != NULL;
834 /* ------------------------------------------------------------------------ */
835 /* Function: ipf_log_canread */
836 /* Returns: int - 0 == no data to read, 1 = data present */
837 /* Parameters: softc(I) - pointer to main soft context */
838 /* unit(I) - device we are reading from */
840 /* Returns how many bytes are currently held in log buffers for the */
841 /* selected ipf device. */
842 /* ------------------------------------------------------------------------ */
844 ipf_log_bytesused(softc, unit)
845 ipf_main_softc_t *softc;
848 ipf_log_softc_t *softl = softc->ipf_log_soft;
853 return softl->ipl_used[unit];
857 /* ------------------------------------------------------------------------ */
858 /* Function: ipf_log_failures */
859 /* Returns: U_QUAD_T - number of log failures */
860 /* Parameters: softc(I) - pointer to main soft context */
861 /* unit(I) - device we are reading from */
863 /* Returns how many times we've tried to log a packet but failed to do so */
864 /* for the selected ipf device. */
865 /* ------------------------------------------------------------------------ */
867 ipf_log_failures(softc, unit)
868 ipf_main_softc_t *softc;
871 ipf_log_softc_t *softl = softc->ipf_log_soft;
876 return softl->ipl_logfail[unit];
880 /* ------------------------------------------------------------------------ */
881 /* Function: ipf_log_logok */
882 /* Returns: U_QUAD_T - number of packets logged */
883 /* Parameters: softc(I) - pointer to main soft context */
884 /* unit(I) - device we are reading from */
886 /* Returns how many times we've successfully logged a packet for the */
887 /* selected ipf device. */
888 /* ------------------------------------------------------------------------ */
890 ipf_log_logok(softc, unit)
891 ipf_main_softc_t *softc;
894 ipf_log_softc_t *softl = softc->ipf_log_soft;
899 return softl->ipl_logok[unit];
901 #endif /* IPFILTER_LOG */