Print this page
OS-7667 IPFilter needs to keep and report state for cloud firewall logging
Portions contributed by: Mike Gerdts <mike.gerdts@joyent.com>
   1 /*
   2  * Copyright (C) 1995-2001 by Darren Reed.
   3  *
   4  * See the IPFILTER.LICENCE file for details on licencing.
   5  *
   6  * @(#)ip_state.h       1.3 1/12/96 (C) 1995 Darren Reed
   7  * $Id: ip_state.h,v 2.68.2.5 2005/08/11 19:58:04 darrenr Exp $
   8  *
   9  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  10  * Use is subject to license terms.

  11  */
  12 
  13 #ifndef __IP_STATE_H__
  14 #define __IP_STATE_H__
  15 


  16 #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
  17 # define        SIOCDELST       _IOW('r', 61, struct ipfobj)
  18 #else
  19 # define        SIOCDELST       _IOW(r, 61, struct ipfobj)
  20 #endif
  21 
  22 struct ipscan;
  23 
  24 #ifndef IPSTATE_SIZE
  25 # define        IPSTATE_SIZE    5737
  26 #endif
  27 #ifndef IPSTATE_MAX
  28 # define        IPSTATE_MAX     50000   /* Maximum number of states held */
  29 #endif
  30 
  31 #define PAIRS(s1,d1,s2,d2)      ((((s1) == (s2)) && ((d1) == (d2))) ||\
  32                                  (((s1) == (d2)) && ((d1) == (s2))))
  33 #define IPPAIR(s1,d1,s2,d2)     PAIRS((s1).s_addr, (d1).s_addr, \
  34                                       (s2).s_addr, (d2).s_addr)
  35 


  49         struct  ipscan  *is_isc;
  50         U_QUAD_T        is_pkts[4];
  51         U_QUAD_T        is_bytes[4];
  52         U_QUAD_T        is_icmppkts[4];
  53         struct  ipftqent is_sti;
  54         u_int   is_frage[2];
  55         int     is_ref;                 /* reference count */
  56         int     is_isninc[2];
  57         u_short is_sumd[2];
  58         i6addr_t        is_src;
  59         i6addr_t        is_dst;
  60         u_int   is_pass;
  61         u_char  is_p;                   /* Protocol */
  62         u_char  is_v;
  63         u_32_t  is_hv;
  64         u_32_t  is_tag;
  65         u_32_t  is_opt[2];              /* packet options set */
  66                                         /* in both directions */
  67         u_32_t  is_optmsk[2];           /*    "      "    mask */
  68                                         /* in both directions */

  69         u_short is_sec;                 /* security options set */
  70         u_short is_secmsk;              /*    "        "    mask */
  71         u_short is_auth;                /* authentication options set */
  72         u_short is_authmsk;             /*    "              "    mask */
  73         union {
  74                 icmpinfo_t      is_ics;
  75                 tcpinfo_t       is_ts;
  76                 udpinfo_t       is_us;
  77                 greinfo_t       is_ug;
  78         } is_ps;
  79         u_32_t  is_flags;
  80         int     is_flx[2][2];
  81         u_32_t  is_rulen;               /* rule number when created */
  82         u_32_t  is_s0[2];
  83         u_short is_smsk[2];
  84         char    is_group[FR_GROUPLEN];
  85         char    is_sbuf[2][16];
  86         char    is_ifname[4][LIFNAMSIZ];
  87 } ipstate_t;
  88 


   1 /*
   2  * Copyright (C) 1995-2001 by Darren Reed.
   3  *
   4  * See the IPFILTER.LICENCE file for details on licencing.
   5  *
   6  * @(#)ip_state.h       1.3 1/12/96 (C) 1995 Darren Reed
   7  * $Id: ip_state.h,v 2.68.2.5 2005/08/11 19:58:04 darrenr Exp $
   8  *
   9  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  10  * Use is subject to license terms.
  11  * Copyright 2019 Joyent, Inc.
  12  */
  13 
  14 #ifndef __IP_STATE_H__
  15 #define __IP_STATE_H__
  16 
  17 #include <sys/uuid.h>
  18 
  19 #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
  20 # define        SIOCDELST       _IOW('r', 61, struct ipfobj)
  21 #else
  22 # define        SIOCDELST       _IOW(r, 61, struct ipfobj)
  23 #endif
  24 
  25 struct ipscan;
  26 
  27 #ifndef IPSTATE_SIZE
  28 # define        IPSTATE_SIZE    5737
  29 #endif
  30 #ifndef IPSTATE_MAX
  31 # define        IPSTATE_MAX     50000   /* Maximum number of states held */
  32 #endif
  33 
  34 #define PAIRS(s1,d1,s2,d2)      ((((s1) == (s2)) && ((d1) == (d2))) ||\
  35                                  (((s1) == (d2)) && ((d1) == (s2))))
  36 #define IPPAIR(s1,d1,s2,d2)     PAIRS((s1).s_addr, (d1).s_addr, \
  37                                       (s2).s_addr, (d2).s_addr)
  38 


  52         struct  ipscan  *is_isc;
  53         U_QUAD_T        is_pkts[4];
  54         U_QUAD_T        is_bytes[4];
  55         U_QUAD_T        is_icmppkts[4];
  56         struct  ipftqent is_sti;
  57         u_int   is_frage[2];
  58         int     is_ref;                 /* reference count */
  59         int     is_isninc[2];
  60         u_short is_sumd[2];
  61         i6addr_t        is_src;
  62         i6addr_t        is_dst;
  63         u_int   is_pass;
  64         u_char  is_p;                   /* Protocol */
  65         u_char  is_v;
  66         u_32_t  is_hv;
  67         u_32_t  is_tag;
  68         u_32_t  is_opt[2];              /* packet options set */
  69                                         /* in both directions */
  70         u_32_t  is_optmsk[2];           /*    "      "    mask */
  71                                         /* in both directions */
  72         uuid_t  is_uuid;
  73         u_short is_sec;                 /* security options set */
  74         u_short is_secmsk;              /*    "        "    mask */
  75         u_short is_auth;                /* authentication options set */
  76         u_short is_authmsk;             /*    "              "    mask */
  77         union {
  78                 icmpinfo_t      is_ics;
  79                 tcpinfo_t       is_ts;
  80                 udpinfo_t       is_us;
  81                 greinfo_t       is_ug;
  82         } is_ps;
  83         u_32_t  is_flags;
  84         int     is_flx[2][2];
  85         u_32_t  is_rulen;               /* rule number when created */
  86         u_32_t  is_s0[2];
  87         u_short is_smsk[2];
  88         char    is_group[FR_GROUPLEN];
  89         char    is_sbuf[2][16];
  90         char    is_ifname[4][LIFNAMSIZ];
  91 } ipstate_t;
  92