Deleted Added
full compact
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
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>
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"
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 $";
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 */
568#ifdef _KERNEL
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
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)
591 ipfilter_sgi_intfsync();
592#endif
593
594 ipfr_fragexpire();
595 fr_timeoutstate();
596 ip_natexpire();
597 fr_authexpire();
598#if defined(_KERNEL)
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);
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}
620#endif /* defined(_KERNEL) */
621}