ip_frag.c (89336) | ip_frag.c (92685) |
---|---|
1/* 2 * Copyright (C) 1993-2001 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 */ 6#if defined(KERNEL) && !defined(_KERNEL) 7# define _KERNEL 8#endif 9 | 1/* 2 * Copyright (C) 1993-2001 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 */ 6#if defined(KERNEL) && !defined(_KERNEL) 7# define _KERNEL 8#endif 9 |
10#ifdef __sgi 11# include <sys/ptimers.h> 12#endif |
|
10#include <sys/errno.h> 11#include <sys/types.h> 12#include <sys/param.h> 13#include <sys/time.h> 14#include <sys/file.h> 15#if !defined(_KERNEL) && !defined(KERNEL) 16# include <stdio.h> 17# include <string.h> 18# include <stdlib.h> 19#endif 20#if (defined(KERNEL) || defined(_KERNEL)) && (__FreeBSD_version >= 220000) 21# include <sys/filio.h> 22# include <sys/fcntl.h> 23#else 24# include <sys/ioctl.h> 25#endif | 13#include <sys/errno.h> 14#include <sys/types.h> 15#include <sys/param.h> 16#include <sys/time.h> 17#include <sys/file.h> 18#if !defined(_KERNEL) && !defined(KERNEL) 19# include <stdio.h> 20# include <string.h> 21# include <stdlib.h> 22#endif 23#if (defined(KERNEL) || defined(_KERNEL)) && (__FreeBSD_version >= 220000) 24# include <sys/filio.h> 25# include <sys/fcntl.h> 26#else 27# include <sys/ioctl.h> 28#endif |
26#include <sys/uio.h> | |
27#ifndef linux 28# include <sys/protosw.h> 29#endif 30#include <sys/socket.h> 31#if defined(_KERNEL) && !defined(linux) 32# include <sys/systm.h> 33#endif 34#if !defined(__SVR4) && !defined(__svr4__) --- 23 unchanged lines hidden (view full) --- 58# include <netinet/ip_var.h> 59#endif 60#include <netinet/tcp.h> 61#include <netinet/udp.h> 62#include <netinet/ip_icmp.h> 63#include "netinet/ip_compat.h" 64#include <netinet/tcpip.h> 65#include "netinet/ip_fil.h" | 29#ifndef linux 30# include <sys/protosw.h> 31#endif 32#include <sys/socket.h> 33#if defined(_KERNEL) && !defined(linux) 34# include <sys/systm.h> 35#endif 36#if !defined(__SVR4) && !defined(__svr4__) --- 23 unchanged lines hidden (view full) --- 60# include <netinet/ip_var.h> 61#endif 62#include <netinet/tcp.h> 63#include <netinet/udp.h> 64#include <netinet/ip_icmp.h> 65#include "netinet/ip_compat.h" 66#include <netinet/tcpip.h> 67#include "netinet/ip_fil.h" |
66#include "netinet/ip_proxy.h" | |
67#include "netinet/ip_nat.h" 68#include "netinet/ip_frag.h" 69#include "netinet/ip_state.h" 70#include "netinet/ip_auth.h" 71#if (__FreeBSD_version >= 300000) 72# include <sys/malloc.h> 73# if (defined(KERNEL) || defined(_KERNEL)) 74# ifndef IPFILTER_LKM --- 9 unchanged lines hidden (view full) --- 84#endif 85#if defined(__OpenBSD__) 86# include <sys/timeout.h> 87extern struct timeout ipfr_slowtimer_ch; 88#endif 89 90#if !defined(lint) 91static const char sccsid[] = "@(#)ip_frag.c 1.11 3/24/96 (C) 1993-2000 Darren Reed"; | 68#include "netinet/ip_nat.h" 69#include "netinet/ip_frag.h" 70#include "netinet/ip_state.h" 71#include "netinet/ip_auth.h" 72#if (__FreeBSD_version >= 300000) 73# include <sys/malloc.h> 74# if (defined(KERNEL) || defined(_KERNEL)) 75# ifndef IPFILTER_LKM --- 9 unchanged lines hidden (view full) --- 85#endif 86#if defined(__OpenBSD__) 87# include <sys/timeout.h> 88extern struct timeout ipfr_slowtimer_ch; 89#endif 90 91#if !defined(lint) 92static const char sccsid[] = "@(#)ip_frag.c 1.11 3/24/96 (C) 1993-2000 Darren Reed"; |
92static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/ip_frag.c 89336 2002-01-14 09:07:15Z alfred $"; | 93static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/ip_frag.c 92685 2002-03-19 11:44:16Z darrenr $"; |
93#endif 94 95 96static ipfr_t *ipfr_heads[IPFT_SIZE]; 97static ipfr_t *ipfr_nattab[IPFT_SIZE]; 98static ipfrstat_t ipfr_stats; 99static int ipfr_inuse = 0; 100 --- 388 unchanged lines hidden (view full) --- 489 } 490 ipfr_delete(fra); 491 } 492 RWLOCK_EXIT(&ipf_natfrag); 493 RWLOCK_EXIT(&ipf_nat); 494} 495 496 | 94#endif 95 96 97static ipfr_t *ipfr_heads[IPFT_SIZE]; 98static ipfr_t *ipfr_nattab[IPFT_SIZE]; 99static ipfrstat_t ipfr_stats; 100static int ipfr_inuse = 0; 101 --- 388 unchanged lines hidden (view full) --- 490 } 491 ipfr_delete(fra); 492 } 493 RWLOCK_EXIT(&ipf_natfrag); 494 RWLOCK_EXIT(&ipf_nat); 495} 496 497 |
497#ifdef _KERNEL | |
498void ipfr_fragexpire() 499{ 500 ipfr_t **fp, *fra; 501 nat_t *nat; 502 int idx; 503#if defined(_KERNEL) 504# if !SOLARIS 505 int s; --- 54 unchanged lines hidden (view full) --- 560 SPL_X(s); 561} 562 563 564/* 565 * Slowly expire held state for fragments. Timeouts are set * in expectation 566 * of this being called twice per second. 567 */ | 498void ipfr_fragexpire() 499{ 500 ipfr_t **fp, *fra; 501 nat_t *nat; 502 int idx; 503#if defined(_KERNEL) 504# if !SOLARIS 505 int s; --- 54 unchanged lines hidden (view full) --- 560 SPL_X(s); 561} 562 563 564/* 565 * Slowly expire held state for fragments. Timeouts are set * in expectation 566 * of this being called twice per second. 567 */ |
568#ifdef _KERNEL |
|
568# if (BSD >= 199306) || SOLARIS || defined(__sgi) 569# if defined(SOLARIS2) && (SOLARIS2 < 7) 570void ipfr_slowtimer() 571# else 572void ipfr_slowtimer __P((void *ptr)) 573# endif 574# else 575int ipfr_slowtimer() 576# endif | 569# if (BSD >= 199306) || SOLARIS || defined(__sgi) 570# if defined(SOLARIS2) && (SOLARIS2 < 7) 571void ipfr_slowtimer() 572# else 573void ipfr_slowtimer __P((void *ptr)) 574# endif 575# else 576int ipfr_slowtimer() 577# endif |
578#else 579void ipfr_slowtimer() 580#endif |
|
577{ 578#if defined(_KERNEL) && SOLARIS 579 extern int fr_running; 580 581 if (fr_running <= 0) 582 return; 583#endif 584 585 READ_ENTER(&ipf_solaris); | 581{ 582#if defined(_KERNEL) && SOLARIS 583 extern int fr_running; 584 585 if (fr_running <= 0) 586 return; 587#endif 588 589 READ_ENTER(&ipf_solaris); |
586#ifdef __sgi | 590#if defined(__sgi) && defined(_KERNEL) |
587 ipfilter_sgi_intfsync(); 588#endif 589 590 ipfr_fragexpire(); 591 fr_timeoutstate(); 592 ip_natexpire(); 593 fr_authexpire(); | 591 ipfilter_sgi_intfsync(); 592#endif 593 594 ipfr_fragexpire(); 595 fr_timeoutstate(); 596 ip_natexpire(); 597 fr_authexpire(); |
598#if defined(_KERNEL) |
|
594# if SOLARIS 595 ipfr_timer_id = timeout(ipfr_slowtimer, NULL, drv_usectohz(500000)); 596 RWLOCK_EXIT(&ipf_solaris); 597# else 598# if defined(__NetBSD__) && (__NetBSD_Version__ >= 104240000) 599 callout_reset(&ipfr_slowtimer_ch, hz / 2, ipfr_slowtimer, NULL); 600# else 601# if (__FreeBSD_version >= 300000) 602 ipfr_slowtimer_ch = timeout(ipfr_slowtimer, NULL, hz/2); 603# else | 599# if SOLARIS 600 ipfr_timer_id = timeout(ipfr_slowtimer, NULL, drv_usectohz(500000)); 601 RWLOCK_EXIT(&ipf_solaris); 602# else 603# if defined(__NetBSD__) && (__NetBSD_Version__ >= 104240000) 604 callout_reset(&ipfr_slowtimer_ch, hz / 2, ipfr_slowtimer, NULL); 605# else 606# if (__FreeBSD_version >= 300000) 607 ipfr_slowtimer_ch = timeout(ipfr_slowtimer, NULL, hz/2); 608# else |
604# if defined(__OpenBSD_) 605 timeout_add(&ipfr_slowtimer_ch, hz/2, ipfr_slowtimer, NULL); | 609# if defined(__OpenBSD__) 610 timeout_add(&ipfr_slowtimer_ch, hz/2); |
606# else 607 timeout(ipfr_slowtimer, NULL, hz/2); 608# endif 609# endif 610# if (BSD < 199306) && !defined(__sgi) 611 return 0; 612# endif /* FreeBSD */ 613# endif /* NetBSD */ 614# endif /* SOLARIS */ | 611# else 612 timeout(ipfr_slowtimer, NULL, hz/2); 613# endif 614# endif 615# if (BSD < 199306) && !defined(__sgi) 616 return 0; 617# endif /* FreeBSD */ 618# endif /* NetBSD */ 619# endif /* SOLARIS */ |
615} | |
616#endif /* defined(_KERNEL) */ | 620#endif /* defined(_KERNEL) */ |
621} |
|