ip_log.c (153084) | ip_log.c (153876) |
---|---|
1/* $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_log.c 153084 2005-12-04 10:06:06Z ru $ */ | 1/* $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_log.c 153876 2005-12-30 11:32:23Z guido $ */ |
2 3/* 4 * Copyright (C) 1997-2003 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * | 2 3/* 4 * Copyright (C) 1997-2003 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * |
8 * $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_log.c 153084 2005-12-04 10:06:06Z ru $ | 8 * $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_log.c 153876 2005-12-30 11:32:23Z guido $ |
9 * Id: ip_log.c,v 2.75.2.6 2004/10/16 07:59:27 darrenr Exp 10 */ 11#include <sys/param.h> 12#if defined(KERNEL) || defined(_KERNEL) 13# undef KERNEL 14# undef _KERNEL 15# define KERNEL 1 16# define _KERNEL 1 --- 397 unchanged lines hidden (view full) --- 414void **items; 415size_t *itemsz; 416int *types, cnt; 417{ 418 caddr_t buf, ptr; 419 iplog_t *ipl; 420 size_t len; 421 int i; | 9 * Id: ip_log.c,v 2.75.2.6 2004/10/16 07:59:27 darrenr Exp 10 */ 11#include <sys/param.h> 12#if defined(KERNEL) || defined(_KERNEL) 13# undef KERNEL 14# undef _KERNEL 15# define KERNEL 1 16# define _KERNEL 1 --- 397 unchanged lines hidden (view full) --- 414void **items; 415size_t *itemsz; 416int *types, cnt; 417{ 418 caddr_t buf, ptr; 419 iplog_t *ipl; 420 size_t len; 421 int i; |
422# if defined(_KERNEL) && !defined(MENTAT) && defined(USE_SPL) 423 int s; 424# endif | 422 SPL_INT(s); |
425 426 /* 427 * Check to see if this log record has a CRC which matches the last 428 * record logged. If it does, just up the count on the previous one 429 * rather than create a new one. 430 */ 431 if (ipl_suppress) { 432 MUTEX_ENTER(&ipl_mutex); --- 103 unchanged lines hidden (view full) --- 536/* ------------------------------------------------------------------------ */ 537int ipflog_read(unit, uio) 538minor_t unit; 539struct uio *uio; 540{ 541 size_t dlen, copied; 542 int error = 0; 543 iplog_t *ipl; | 423 424 /* 425 * Check to see if this log record has a CRC which matches the last 426 * record logged. If it does, just up the count on the previous one 427 * rather than create a new one. 428 */ 429 if (ipl_suppress) { 430 MUTEX_ENTER(&ipl_mutex); --- 103 unchanged lines hidden (view full) --- 534/* ------------------------------------------------------------------------ */ 535int ipflog_read(unit, uio) 536minor_t unit; 537struct uio *uio; 538{ 539 size_t dlen, copied; 540 int error = 0; 541 iplog_t *ipl; |
544# if defined(_KERNEL) && !defined(MENTAT) && defined(USE_SPL) 545 int s; 546# endif | 542 SPL_INT(s); |
547 548 /* 549 * Sanity checks. Make sure the minor # is valid and we're copying 550 * a valid chunk of data. 551 */ 552 if (IPL_LOGMAX < unit) 553 return ENXIO; 554 if (uio->uio_resid == 0) --- 95 unchanged lines hidden (view full) --- 650/* */ 651/* Deletes all queued up log records for a given output device. */ 652/* ------------------------------------------------------------------------ */ 653int ipflog_clear(unit) 654minor_t unit; 655{ 656 iplog_t *ipl; 657 int used; | 543 544 /* 545 * Sanity checks. Make sure the minor # is valid and we're copying 546 * a valid chunk of data. 547 */ 548 if (IPL_LOGMAX < unit) 549 return ENXIO; 550 if (uio->uio_resid == 0) --- 95 unchanged lines hidden (view full) --- 646/* */ 647/* Deletes all queued up log records for a given output device. */ 648/* ------------------------------------------------------------------------ */ 649int ipflog_clear(unit) 650minor_t unit; 651{ 652 iplog_t *ipl; 653 int used; |
658# if defined(_KERNEL) && !defined(MENTAT) && defined(USE_SPL) 659 int s; 660# endif | 654 SPL_INT(s); |
661 662 SPL_NET(s); 663 MUTEX_ENTER(&ipl_mutex); 664 while ((ipl = iplt[unit]) != NULL) { 665 iplt[unit] = ipl->ipl_next; 666 KFREES((caddr_t)ipl, ipl->ipl_dsize); 667 } 668 iplh[unit] = &iplt[unit]; 669 ipll[unit] = NULL; 670 used = iplused[unit]; 671 iplused[unit] = 0; 672 bzero((char *)&iplcrc[unit], FI_CSIZE); 673 MUTEX_EXIT(&ipl_mutex); 674 SPL_X(s); 675 return used; 676} 677#endif /* IPFILTER_LOG */ | 655 656 SPL_NET(s); 657 MUTEX_ENTER(&ipl_mutex); 658 while ((ipl = iplt[unit]) != NULL) { 659 iplt[unit] = ipl->ipl_next; 660 KFREES((caddr_t)ipl, ipl->ipl_dsize); 661 } 662 iplh[unit] = &iplt[unit]; 663 ipll[unit] = NULL; 664 used = iplused[unit]; 665 iplused[unit] = 0; 666 bzero((char *)&iplcrc[unit], FI_CSIZE); 667 MUTEX_EXIT(&ipl_mutex); 668 SPL_X(s); 669 return used; 670} 671#endif /* IPFILTER_LOG */ |