ip_log.c (94bdecd9) | ip_log.c (af5f29dd) |
---|---|
1/* 2 * Copyright (C) 1997-2003 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 * 6 * $Id: ip_log.c,v 2.75.2.7 2005/06/11 07:47:44 darrenr Exp $ 7 * 8 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. --- 50 unchanged lines hidden (view full) --- 59#endif 60#include <sys/time.h> 61#if defined(_KERNEL) 62# include <sys/systm.h> 63# if defined(NetBSD) && (__NetBSD_Version__ >= 104000000) 64# include <sys/proc.h> 65# endif 66#endif /* _KERNEL */ | 1/* 2 * Copyright (C) 1997-2003 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 * 6 * $Id: ip_log.c,v 2.75.2.7 2005/06/11 07:47:44 darrenr Exp $ 7 * 8 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. --- 50 unchanged lines hidden (view full) --- 59#endif 60#include <sys/time.h> 61#if defined(_KERNEL) 62# include <sys/systm.h> 63# if defined(NetBSD) && (__NetBSD_Version__ >= 104000000) 64# include <sys/proc.h> 65# endif 66#endif /* _KERNEL */ |
67#if !SOLARIS && !defined(__hpux) && !defined(linux) | 67#if !defined(SOLARIS) && !defined(__hpux) && !defined(linux) |
68# if (NetBSD > 199609) || (OpenBSD > 199603) || (__FreeBSD_version >= 300000) 69# include <sys/dirent.h> 70# else 71# include <sys/dir.h> 72# endif 73# include <sys/mbuf.h> 74#else 75# if !defined(__hpux) && defined(_KERNEL) --- 99 unchanged lines hidden (view full) --- 175 iplog_ss[i].read_waiter = 0; 176 iplog_ss[i].state = 0; 177# endif 178# if defined(linux) && defined(_KERNEL) 179 init_waitqueue_head(iplh_linux + i); 180# endif 181 } 182 | 68# if (NetBSD > 199609) || (OpenBSD > 199603) || (__FreeBSD_version >= 300000) 69# include <sys/dirent.h> 70# else 71# include <sys/dir.h> 72# endif 73# include <sys/mbuf.h> 74#else 75# if !defined(__hpux) && defined(_KERNEL) --- 99 unchanged lines hidden (view full) --- 175 iplog_ss[i].read_waiter = 0; 176 iplog_ss[i].state = 0; 177# endif 178# if defined(linux) && defined(_KERNEL) 179 init_waitqueue_head(iplh_linux + i); 180# endif 181 } 182 |
183# if SOLARIS && defined(_KERNEL) | 183# if defined(SOLARIS) && defined(_KERNEL) |
184 cv_init(&ifs->ifs_iplwait, "ipl condvar", CV_DRIVER, NULL); 185# endif 186 MUTEX_INIT(&ifs->ifs_ipl_mutex, "ipf log mutex"); 187 188 ifs->ifs_ipl_log_init = 1; 189 190 return 0; 191} --- 12 unchanged lines hidden (view full) --- 204 int i; 205 206 if (ifs->ifs_ipl_log_init == 0) 207 return; 208 209 for (i = IPL_LOGMAX; i >= 0; i--) 210 (void) ipflog_clear(i, ifs); 211 | 184 cv_init(&ifs->ifs_iplwait, "ipl condvar", CV_DRIVER, NULL); 185# endif 186 MUTEX_INIT(&ifs->ifs_ipl_mutex, "ipf log mutex"); 187 188 ifs->ifs_ipl_log_init = 1; 189 190 return 0; 191} --- 12 unchanged lines hidden (view full) --- 204 int i; 205 206 if (ifs->ifs_ipl_log_init == 0) 207 return; 208 209 for (i = IPL_LOGMAX; i >= 0; i--) 210 (void) ipflog_clear(i, ifs); 211 |
212# if SOLARIS && defined(_KERNEL) | 212# if defined(SOLARIS) && defined(_KERNEL) |
213 cv_destroy(&ifs->ifs_iplwait); 214# endif 215 MUTEX_DESTROY(&ifs->ifs_ipl_mutex); 216 217 ifs->ifs_ipl_log_init = 0; 218} 219 220 --- 15 unchanged lines hidden (view full) --- 236{ 237 register size_t hlen; 238 int types[2], mlen; 239 size_t sizes[2]; 240 void *ptrs[2]; 241 ipflog_t ipfl; 242 u_char p; 243 mb_t *m; | 213 cv_destroy(&ifs->ifs_iplwait); 214# endif 215 MUTEX_DESTROY(&ifs->ifs_ipl_mutex); 216 217 ifs->ifs_ipl_log_init = 0; 218} 219 220 --- 15 unchanged lines hidden (view full) --- 236{ 237 register size_t hlen; 238 int types[2], mlen; 239 size_t sizes[2]; 240 void *ptrs[2]; 241 ipflog_t ipfl; 242 u_char p; 243 mb_t *m; |
244# if SOLARIS && defined(_KERNEL) | 244# if defined(SOLARIS) && defined(_KERNEL) |
245 net_handle_t nif; 246 void *ifp; 247# else 248# if defined(__hpux) && defined(_KERNEL) 249 qif_t *ifp; 250# else 251 struct ifnet *ifp; 252# endif --- 59 unchanged lines hidden (view full) --- 312 } 313 } 314# endif 315 } 316 /* 317 * Get the interface number and name to which this packet is 318 * currently associated. 319 */ | 245 net_handle_t nif; 246 void *ifp; 247# else 248# if defined(__hpux) && defined(_KERNEL) 249 qif_t *ifp; 250# else 251 struct ifnet *ifp; 252# endif --- 59 unchanged lines hidden (view full) --- 312 } 313 } 314# endif 315 } 316 /* 317 * Get the interface number and name to which this packet is 318 * currently associated. 319 */ |
320# if SOLARIS && defined(_KERNEL) | 320# if defined(SOLARIS) && defined(_KERNEL) |
321 ipfl.fl_unit = (u_int)0; 322 nif = NULL; 323 if (fin->fin_fi.fi_v == 4) 324 nif = ifs->ifs_ipf_ipv4; 325 else if (fin->fin_fi.fi_v == 6) 326 nif = ifs->ifs_ipf_ipv6; 327 if (nif != NULL) { 328 if (net_getifname(nif, (phy_if_t)ifp, --- 182 unchanged lines hidden (view full) --- 511 ifs->ifs_ipll[dev] = ipl; 512 *ifs->ifs_iplh[dev] = ipl; 513 ifs->ifs_iplh[dev] = &ipl->ipl_next; 514 515 /* 516 * Now that the log record has been completed and added to the queue, 517 * wake up any listeners who may want to read it. 518 */ | 321 ipfl.fl_unit = (u_int)0; 322 nif = NULL; 323 if (fin->fin_fi.fi_v == 4) 324 nif = ifs->ifs_ipf_ipv4; 325 else if (fin->fin_fi.fi_v == 6) 326 nif = ifs->ifs_ipf_ipv6; 327 if (nif != NULL) { 328 if (net_getifname(nif, (phy_if_t)ifp, --- 182 unchanged lines hidden (view full) --- 511 ifs->ifs_ipll[dev] = ipl; 512 *ifs->ifs_iplh[dev] = ipl; 513 ifs->ifs_iplh[dev] = &ipl->ipl_next; 514 515 /* 516 * Now that the log record has been completed and added to the queue, 517 * wake up any listeners who may want to read it. 518 */ |
519# if SOLARIS && defined(_KERNEL) | 519# if defined(SOLARIS) && defined(_KERNEL) |
520 cv_signal(&ifs->ifs_iplwait); 521 MUTEX_EXIT(&ifs->ifs_ipl_mutex); 522# else 523 MUTEX_EXIT(&ifs->ifs_ipl_mutex); 524 WAKEUP(&ifs->ifs_iplh, dev); 525# endif 526 SPL_X(s); 527# ifdef IPL_SELECT --- 40 unchanged lines hidden (view full) --- 568 /* 569 * Lock the log so we can snapshot the variables. Wait for a signal 570 * if the log is empty. 571 */ 572 SPL_NET(s); 573 MUTEX_ENTER(&ifs->ifs_ipl_mutex); 574 575 while (ifs->ifs_iplt[unit] == NULL) { | 520 cv_signal(&ifs->ifs_iplwait); 521 MUTEX_EXIT(&ifs->ifs_ipl_mutex); 522# else 523 MUTEX_EXIT(&ifs->ifs_ipl_mutex); 524 WAKEUP(&ifs->ifs_iplh, dev); 525# endif 526 SPL_X(s); 527# ifdef IPL_SELECT --- 40 unchanged lines hidden (view full) --- 568 /* 569 * Lock the log so we can snapshot the variables. Wait for a signal 570 * if the log is empty. 571 */ 572 SPL_NET(s); 573 MUTEX_ENTER(&ifs->ifs_ipl_mutex); 574 575 while (ifs->ifs_iplt[unit] == NULL) { |
576# if SOLARIS && defined(_KERNEL) | 576# if defined(SOLARIS) && defined(_KERNEL) |
577 /* 578 * Prevent a deadlock with ipldetach() - see the "ipfilter 579 * kernel module mutexes and locking" comment block in solaris.c 580 * for details. 581 */ 582 RWLOCK_EXIT(&ifs->ifs_ipf_global); 583 if (!cv_wait_sig(&ifs->ifs_iplwait, &ifs->ifs_ipl_mutex.ipf_lk)) { 584 READ_ENTER(&ifs->ifs_ipf_global); --- 112 unchanged lines hidden --- | 577 /* 578 * Prevent a deadlock with ipldetach() - see the "ipfilter 579 * kernel module mutexes and locking" comment block in solaris.c 580 * for details. 581 */ 582 RWLOCK_EXIT(&ifs->ifs_ipf_global); 583 if (!cv_wait_sig(&ifs->ifs_iplwait, &ifs->ifs_ipl_mutex.ipf_lk)) { 584 READ_ENTER(&ifs->ifs_ipf_global); --- 112 unchanged lines hidden --- |