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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ipf/fil.c
          +++ new/usr/src/uts/common/inet/ipf/fil.c
   1    1  /*
   2    2   * Copyright (C) 1993-2003 by Darren Reed.
   3    3   *
   4    4   * See the IPFILTER.LICENCE file for details on licencing.
   5    5   *
   6    6   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   7    7   *
   8      - * Copyright (c) 2014, Joyent, Inc.  All rights reserved.
        8 + * Copyright 2019 Joyent, Inc.
   9    9   */
  10   10  
  11   11  #if defined(KERNEL) || defined(_KERNEL)
  12   12  # undef KERNEL
  13   13  # undef _KERNEL
  14   14  # define        KERNEL  1
  15   15  # define        _KERNEL 1
  16   16  #endif
  17   17  #include <sys/errno.h>
  18   18  #include <sys/types.h>
↓ open down ↓ 2562 lines elided ↑ open up ↑
2581 2581                          }
2582 2582                  }
2583 2583          }
2584 2584  
2585 2585  #ifdef  IPFILTER_LOG
2586 2586          if ((ifs->ifs_fr_flags & FF_LOGGING) || (pass & FR_LOGMASK)) {
2587 2587                  (void) fr_dolog(fin, &pass);
2588 2588          }
2589 2589  #endif
2590 2590  
     2591 +        if (IFS_CFWLOG(ifs, fr) && FR_ISBLOCK(pass))
     2592 +                ipf_block_cfwlog(fr, fin, ifs);
     2593 +
2591 2594          /*
2592 2595           * The FI_STATE flag is cleared here so that calling fr_checkstate
2593 2596           * will work when called from inside of fr_fastroute.  Although
2594 2597           * there is a similar flag, FI_NATED, for NAT, it does have the same
2595 2598           * impact on code execution.
2596 2599           */
2597 2600          fin->fin_flx &= ~FI_STATE;
2598 2601  
2599 2602          /*
2600 2603           * Only allow FR_DUP to work if a rule matched - it makes no sense to
↓ open down ↓ 5138 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX