[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/ip_state.h

Version: -  FREEBSD  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  cheribsd  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1  -  FREEBSD-LIBC  -  FREEBSD8-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: ip_state.h,v 1.24.2.1 2004/08/13 03:56:09 jmc Exp $    */
    2 
    3 /*
    4  * Copyright (C) 1995-2001 by Darren Reed.
    5  *
    6  * See the IPFILTER.LICENCE file for details on licencing.
    7  *
    8  * @(#)ip_state.h       1.3 1/12/96 (C) 1995 Darren Reed
    9  * Id: ip_state.h,v 2.68.2.1 2004/06/30 11:26:12 darrenr Exp
   10  */
   11 #ifndef _NETINET_IP_STATE_H_
   12 #define _NETINET_IP_STATE_H_
   13 
   14 #if defined(__STDC__) || defined(__GNUC__)
   15 # define        SIOCDELST       _IOW('r', 61, struct ipfobj)
   16 #else
   17 # define        SIOCDELST       _IOW(r, 61, struct ipfobj)
   18 #endif
   19 
   20 struct ipscan;
   21 
   22 #ifndef IPSTATE_SIZE
   23 # define        IPSTATE_SIZE    5737
   24 #endif
   25 #ifndef IPSTATE_MAX
   26 # define        IPSTATE_MAX     4013    /* Maximum number of states held */
   27 #endif
   28 
   29 #define PAIRS(s1,d1,s2,d2)      ((((s1) == (s2)) && ((d1) == (d2))) ||\
   30                                  (((s1) == (d2)) && ((d1) == (s2))))
   31 #define IPPAIR(s1,d1,s2,d2)     PAIRS((s1).s_addr, (d1).s_addr, \
   32                                       (s2).s_addr, (d2).s_addr)
   33 
   34 
   35 typedef struct ipstate {
   36         ipfmutex_t      is_lock;
   37         struct  ipstate *is_next;
   38         struct  ipstate **is_pnext;
   39         struct  ipstate *is_hnext;
   40         struct  ipstate **is_phnext;
   41         struct  ipstate **is_me;
   42         void            *is_ifp[4];
   43         void            *is_sync;
   44         struct nat      *is_nat[2];
   45         frentry_t       *is_rule;
   46         struct  ipftq   *is_tqehead[2];
   47         struct  ipscan  *is_isc;
   48         U_QUAD_T        is_pkts[4];
   49         U_QUAD_T        is_bytes[4];
   50         U_QUAD_T        is_icmppkts[4];
   51         struct  ipftqent is_sti;
   52         u_int   is_frage[2];
   53         int     is_ref;                 /* reference count */
   54         int     is_isninc[2];
   55         u_short is_sumd[2];
   56         i6addr_t        is_src;
   57         i6addr_t        is_dst;
   58         u_int   is_pass;
   59         u_char  is_p;                   /* Protocol */
   60         u_char  is_v;
   61         u_32_t  is_hv;
   62         u_32_t  is_tag;
   63         u_32_t  is_opt;                 /* packet options set */
   64         u_32_t  is_optmsk;              /*    "      "    mask */
   65         u_short is_sec;                 /* security options set */
   66         u_short is_secmsk;              /*    "        "    mask */
   67         u_short is_auth;                /* authentication options set */
   68         u_short is_authmsk;             /*    "              "    mask */
   69         union {
   70                 icmpinfo_t      is_ics;
   71                 tcpinfo_t       is_ts;
   72                 udpinfo_t       is_us;
   73                 greinfo_t       is_ug;
   74         } is_ps;
   75         u_32_t  is_flags;
   76         int     is_flx[2][2];
   77         u_32_t  is_rulen;               /* rule number when created */
   78         u_32_t  is_s0[2];
   79         u_short is_smsk[2];
   80         char    is_group[FR_GROUPLEN];
   81         char    is_sbuf[2][16];
   82         char    is_ifname[4][LIFNAMSIZ];
   83 } ipstate_t;
   84 
   85 #define is_die          is_sti.tqe_die
   86 #define is_state        is_sti.tqe_state
   87 #define is_touched      is_sti.tqe_touched
   88 #define is_saddr        is_src.in4.s_addr
   89 #define is_daddr        is_dst.in4.s_addr
   90 #define is_icmp         is_ps.is_ics
   91 #define is_type         is_icmp.ici_type
   92 #define is_code         is_icmp.ici_code
   93 #define is_tcp          is_ps.is_ts
   94 #define is_udp          is_ps.is_us
   95 #define is_send         is_tcp.ts_data[0].td_end
   96 #define is_dend         is_tcp.ts_data[1].td_end
   97 #define is_maxswin      is_tcp.ts_data[0].td_maxwin
   98 #define is_maxdwin      is_tcp.ts_data[1].td_maxwin
   99 #define is_maxsend      is_tcp.ts_data[0].td_maxend
  100 #define is_maxdend      is_tcp.ts_data[1].td_maxend
  101 #define is_swinscale    is_tcp.ts_data[0].td_winscale
  102 #define is_dwinscale    is_tcp.ts_data[1].td_winscale
  103 #define is_swinflags    is_tcp.ts_data[0].td_winflags
  104 #define is_dwinflags    is_tcp.ts_data[1].td_winflags
  105 #define is_sport        is_tcp.ts_sport
  106 #define is_dport        is_tcp.ts_dport
  107 #define is_ifpin        is_ifp[0]
  108 #define is_ifpout       is_ifp[2]
  109 #define is_gre          is_ps.is_ug
  110 
  111 #define IS_WSPORT       SI_W_SPORT      /* 0x00100 */
  112 #define IS_WDPORT       SI_W_DPORT      /* 0x00200 */
  113 #define IS_WSADDR       SI_W_SADDR      /* 0x00400 */
  114 #define IS_WDADDR       SI_W_DADDR      /* 0x00800 */
  115 #define IS_NEWFR        SI_NEWFR        /* 0x01000 */
  116 #define IS_CLONE        SI_CLONE        /* 0x02000 */
  117 #define IS_CLONED       SI_CLONED       /* 0x04000 */
  118 #define IS_TCPFSM                          0x10000
  119 #define IS_STRICT                          0x20000
  120 #define IS_ISNSYN                          0x40000
  121 #define IS_ISNACK                          0x80000
  122 /*
  123  * IS_SC flags are for scan-operations that need to be recognised in state.
  124  */
  125 #define IS_SC_CLIENT                    0x10000000
  126 #define IS_SC_SERVER                    0x20000000
  127 #define IS_SC_MATCHC                    0x40000000
  128 #define IS_SC_MATCHS                    0x80000000
  129 #define IS_SC_MATCHALL  (IS_SC_MATCHC|IS_SC_MATCHC)
  130 #define IS_SC_ALL       (IS_SC_MATCHC|IS_SC_MATCHC|IS_SC_CLIENT|IS_SC_SERVER)
  131 
  132 /*
  133  * Flags that can be passed into fr_addstate
  134  */
  135 #define IS_INHERITED                    0x0fffff00
  136 
  137 #define TH_OPENING      (TH_SYN|TH_ACK)
  138 /*
  139  * is_flags:
  140  * Bits 0 - 3 are use as a mask with the current packet's bits to check for
  141  * whether it is short, tcp/udp, a fragment or the presence of IP options.
  142  * Bits 4 - 7 are set from the initial packet and contain what the packet
  143  * anded with bits 0-3 must match.
  144  * Bits 8,9 are used to indicate wildcard source/destination port matching.
  145  * Bits 10,11 are reserved for other wildcard flag compatibility.
  146  * Bits 12,13 are for scaning.
  147  */
  148 
  149 typedef struct  ipstate_save    {
  150         void    *ips_next;
  151         struct  ipstate ips_is;
  152         struct  frentry ips_fr;
  153 } ipstate_save_t;
  154 
  155 #define ips_rule        ips_is.is_rule
  156 
  157 
  158 typedef struct  ipslog  {
  159         U_QUAD_T        isl_pkts[4];
  160         U_QUAD_T        isl_bytes[4];
  161         i6addr_t        isl_src;
  162         i6addr_t        isl_dst;
  163         u_32_t  isl_tag;
  164         u_short isl_type;
  165         union {
  166                 u_short isl_filler[2];
  167                 u_short isl_ports[2];
  168                 u_short isl_icmp;
  169         } isl_ps;
  170         u_char  isl_v;
  171         u_char  isl_p;
  172         u_char  isl_flags;
  173         u_char  isl_state[2];
  174         u_32_t  isl_rulen;
  175         char    isl_group[FR_GROUPLEN];
  176 } ipslog_t;
  177 
  178 #define isl_sport       isl_ps.isl_ports[0]
  179 #define isl_dport       isl_ps.isl_ports[1]
  180 #define isl_itype       isl_ps.isl_icmp
  181 
  182 #define ISL_NEW                 0
  183 #define ISL_CLONE               1
  184 #define ISL_EXPIRE              0xffff
  185 #define ISL_FLUSH               0xfffe
  186 #define ISL_REMOVE              0xfffd
  187 #define ISL_INTERMEDIATE        0xfffc
  188 #define ISL_KILLED              0xfffb
  189 #define ISL_ORPHAN              0xfffa
  190 
  191 
  192 typedef struct  ips_stat {
  193         u_long  iss_hits;
  194         u_long  iss_miss;
  195         u_long  iss_max;
  196         u_long  iss_maxref;
  197         u_long  iss_tcp;
  198         u_long  iss_udp;
  199         u_long  iss_icmp;
  200         u_long  iss_nomem;
  201         u_long  iss_expire;
  202         u_long  iss_fin;
  203         u_long  iss_active;
  204         u_long  iss_logged;
  205         u_long  iss_logfail;
  206         u_long  iss_inuse;
  207         u_long  iss_wild;
  208         u_long  iss_killed;
  209         u_long  iss_ticks;
  210         u_long  iss_bucketfull;
  211         int     iss_statesize;
  212         int     iss_statemax;
  213         ipstate_t **iss_table;
  214         ipstate_t *iss_list;
  215         u_long  *iss_bucketlen;
  216 } ips_stat_t;
  217 
  218 
  219 extern  u_long  fr_tcpidletimeout;
  220 extern  u_long  fr_tcpclosewait;
  221 extern  u_long  fr_tcplastack;
  222 extern  u_long  fr_tcptimeout;
  223 extern  u_long  fr_tcpclosed;
  224 extern  u_long  fr_tcphalfclosed;
  225 extern  u_long  fr_udptimeout;
  226 extern  u_long  fr_udpacktimeout;
  227 extern  u_long  fr_icmptimeout;
  228 extern  u_long  fr_icmpacktimeout;
  229 extern  int     fr_statemax;
  230 extern  int     fr_statesize;
  231 extern  int     fr_state_lock;
  232 extern  int     fr_state_maxbucket;
  233 extern  int     fr_state_maxbucket_reset;
  234 extern  ipstate_t       *ips_list;
  235 extern  ipftq_t *ips_utqe;
  236 extern  ipftq_t ips_tqtqb[IPF_TCP_NSTATES];
  237 
  238 extern  int     fr_stateinit __P((void));
  239 extern  ipstate_t *fr_addstate __P((fr_info_t *, ipstate_t **, u_int));
  240 extern  frentry_t *fr_checkstate __P((struct fr_info *, u_32_t *));
  241 extern  ipstate_t *fr_stlookup __P((fr_info_t *, tcphdr_t *, ipftq_t **));
  242 extern  void    fr_statesync __P((void *));
  243 extern  void    fr_timeoutstate __P((void));
  244 extern  int     fr_tcp_age __P((struct ipftqent *, struct fr_info *,
  245                                 struct ipftq *, int));
  246 extern  int     fr_tcpinwindow __P((struct fr_info *, struct tcpdata *,
  247                                     struct tcpdata *, tcphdr_t *, int));
  248 extern  void    fr_stateunload __P((void));
  249 extern  void    ipstate_log __P((struct ipstate *, u_int));
  250 extern  int     fr_state_ioctl __P((caddr_t, ioctlcmd_t, int));
  251 extern  void    fr_stinsert __P((struct ipstate *, int));
  252 extern  void    fr_sttab_init __P((struct ipftq *));
  253 extern  void    fr_sttab_destroy __P((struct ipftq *));
  254 extern  void    fr_updatestate __P((fr_info_t *, ipstate_t *, ipftq_t *));
  255 extern  void    fr_statederef __P((fr_info_t *, ipstate_t **));
  256 extern  void    fr_setstatequeue __P((ipstate_t *, int));
  257 
  258 #endif /* _NETINET_IP_STATE_H_ */

Cache object: 6784a94fb34d28a50f07b00bcf24c9e1


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.