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/cmd/ipf/lib/common/printfr.c
          +++ new/usr/src/cmd/ipf/lib/common/printfr.c
   1    1  /*
   2    2   * Copyright (C) 2000-2005 by Darren Reed.
   3    3   *
   4    4   * See the IPFILTER.LICENCE file for details on licencing.
   5    5   *
   6    6   * $Id: printfr.c,v 1.43.2.12 2005/06/12 07:18:42 darrenr Exp $
   7    7   *
   8    8   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
   9    9   * Use is subject to license terms.
       10 + * Copyright 2019 Joyent, Inc.
  10   11   */
  11   12  
  12      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       13 +#include <uuid/uuid.h>
  13   14  
  14   15  #include "ipf.h"
  15   16  
  16   17  /*
  17   18   * print the filter structure in a useful way
  18   19   */
  19   20  void    printfr(fp, iocfunc)
  20   21  struct  frentry *fp;
  21   22  ioctlfunc_t     iocfunc;
  22   23  {
↓ open down ↓ 356 lines elided ↑ open up ↑
 379  380          if (fp->fr_isc != (struct ipscan *)-1) {
 380  381                  if (fp->fr_isctag[0])
 381  382                          printf(" scan %s", fp->fr_isctag);
 382  383                  else
 383  384                          printf(" scan *");
 384  385          }
 385  386          if (*fp->fr_grhead != '\0')
 386  387                  printf(" head %s", fp->fr_grhead);
 387  388          if (*fp->fr_group != '\0')
 388  389                  printf(" group %s", fp->fr_group);
 389      -        if (fp->fr_logtag != FR_NOLOGTAG || *fp->fr_nattag.ipt_tag) {
      390 +        if (fp->fr_logtag != FR_NOLOGTAG || *fp->fr_nattag.ipt_tag ||
      391 +            (fp->fr_flags & FR_CFWLOG) || !uuid_is_null(fp->fr_uuid)) {
 390  392                  char *s = "";
 391  393  
 392  394                  printf(" set-tag(");
 393  395                  if (fp->fr_logtag != FR_NOLOGTAG) {
 394  396                          printf("log=%u", fp->fr_logtag);
 395  397                          s = ", ";
 396  398                  }
 397  399                  if (*fp->fr_nattag.ipt_tag) {
 398  400                          printf("%snat=%-.*s", s, IPFTAG_LEN,
 399  401                                  fp->fr_nattag.ipt_tag);
      402 +                        s = ", ";
 400  403                  }
      404 +                if (fp->fr_flags & FR_CFWLOG) {
      405 +                        printf("cfwlog");
      406 +                        s = ", ";
      407 +                }
      408 +
      409 +                if (!uuid_is_null(fp->fr_uuid)) {
      410 +                        char uuid[UUID_PRINTABLE_STRING_LENGTH];
      411 +
      412 +                        uuid_unparse(fp->fr_uuid, uuid);
      413 +                        printf("%suuid=%s", s, uuid);
      414 +                }
 401  415                  printf(")");
 402  416          }
 403  417          if (fp->fr_pps)
 404  418                  printf(" pps %d", fp->fr_pps);
 405  419          (void)putchar('\n');
 406  420  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX