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>


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright (c) 2015, Joyent, Inc. All rights reserved.
  25  */
  26 
  27 #include <regex.h>
  28 #include <devfsadm.h>
  29 #include <stdio.h>
  30 #include <strings.h>
  31 #include <stdlib.h>
  32 #include <limits.h>
  33 #include <sys/zone.h>
  34 #include <sys/zcons.h>
  35 #include <sys/zfd.h>
  36 #include <sys/cpuid_drv.h>
  37 
  38 static int display(di_minor_t minor, di_node_t node);
  39 static int parallel(di_minor_t minor, di_node_t node);
  40 static int node_slash_minor(di_minor_t minor, di_node_t node);
  41 static int driver_minor(di_minor_t minor, di_node_t node);
  42 static int node_name(di_minor_t minor, di_node_t node);
  43 static int minor_name(di_minor_t minor, di_node_t node);
  44 static int wifi_minor_name(di_minor_t minor, di_node_t node);


 107             "(^ptc$)|(^openeepr$)|(^poll$)|(^sysmsg$)|(^random$)|(^trapstat$)|"
 108             "(^cryptoadm$)|(^crypto$)|(^pool$)|(^poolctl$)|(^bl$)|(^kmdb$)|"
 109             "(^sysevent$)|(^kssl$)|(^physmem$)",
 110             TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name
 111         },
 112         { "pseudo", "ddi_pseudo",
 113             "(^ip$)|(^tcp$)|(^udp$)|(^icmp$)|"
 114             "(^ip6$)|(^tcp6$)|(^udp6$)|(^icmp6$)|"
 115             "(^rts$)|(^arp$)|(^ipsecah$)|(^ipsecesp$)|(^keysock$)|(^spdsock$)|"
 116             "(^nca$)|(^rds$)|(^sdp$)|(^ipnet$)|(^dlpistub$)|(^bpf$)",
 117             TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name
 118         },
 119         { "pseudo", "ddi_pseudo", "inotify",
 120             TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name
 121         },
 122         { "pseudo", "ddi_pseudo", "ipd",
 123             TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name
 124         },
 125         { "pseudo", "ddi_pseudo",
 126             "(^ipf$)|(^ipnat$)|(^ipstate$)|(^ipauth$)|"
 127             "(^ipsync$)|(^ipscan$)|(^iplookup$)",
 128             TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name,
 129         },
 130         { "pseudo", "ddi_pseudo", "dld",
 131             TYPE_EXACT | DRV_EXACT, ILEVEL_0, node_name
 132         },
 133         { "pseudo", "ddi_pseudo",
 134             "(^kdmouse$)|(^rootprop$)",
 135             TYPE_EXACT | DRV_RE, ILEVEL_0, node_name
 136         },
 137         { "pseudo", "ddi_pseudo", "timerfd",
 138             TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name
 139         },
 140         { "pseudo", "ddi_pseudo", "tod",
 141             TYPE_EXACT | DRV_EXACT, ILEVEL_0, node_name
 142         },
 143         { "pseudo", "ddi_pseudo", "envctrl(two)?",
 144             TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name,
 145         },
 146         { "pseudo", "ddi_pseudo", "fcode",
 147             TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name,




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright 2019 Joyent, Inc.
  25  */
  26 
  27 #include <regex.h>
  28 #include <devfsadm.h>
  29 #include <stdio.h>
  30 #include <strings.h>
  31 #include <stdlib.h>
  32 #include <limits.h>
  33 #include <sys/zone.h>
  34 #include <sys/zcons.h>
  35 #include <sys/zfd.h>
  36 #include <sys/cpuid_drv.h>
  37 
  38 static int display(di_minor_t minor, di_node_t node);
  39 static int parallel(di_minor_t minor, di_node_t node);
  40 static int node_slash_minor(di_minor_t minor, di_node_t node);
  41 static int driver_minor(di_minor_t minor, di_node_t node);
  42 static int node_name(di_minor_t minor, di_node_t node);
  43 static int minor_name(di_minor_t minor, di_node_t node);
  44 static int wifi_minor_name(di_minor_t minor, di_node_t node);


 107             "(^ptc$)|(^openeepr$)|(^poll$)|(^sysmsg$)|(^random$)|(^trapstat$)|"
 108             "(^cryptoadm$)|(^crypto$)|(^pool$)|(^poolctl$)|(^bl$)|(^kmdb$)|"
 109             "(^sysevent$)|(^kssl$)|(^physmem$)",
 110             TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name
 111         },
 112         { "pseudo", "ddi_pseudo",
 113             "(^ip$)|(^tcp$)|(^udp$)|(^icmp$)|"
 114             "(^ip6$)|(^tcp6$)|(^udp6$)|(^icmp6$)|"
 115             "(^rts$)|(^arp$)|(^ipsecah$)|(^ipsecesp$)|(^keysock$)|(^spdsock$)|"
 116             "(^nca$)|(^rds$)|(^sdp$)|(^ipnet$)|(^dlpistub$)|(^bpf$)",
 117             TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name
 118         },
 119         { "pseudo", "ddi_pseudo", "inotify",
 120             TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name
 121         },
 122         { "pseudo", "ddi_pseudo", "ipd",
 123             TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name
 124         },
 125         { "pseudo", "ddi_pseudo",
 126             "(^ipf$)|(^ipnat$)|(^ipstate$)|(^ipauth$)|"
 127             "(^ipsync$)|(^ipscan$)|(^iplookup$)|(^ipfev$)",
 128             TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name,
 129         },
 130         { "pseudo", "ddi_pseudo", "dld",
 131             TYPE_EXACT | DRV_EXACT, ILEVEL_0, node_name
 132         },
 133         { "pseudo", "ddi_pseudo",
 134             "(^kdmouse$)|(^rootprop$)",
 135             TYPE_EXACT | DRV_RE, ILEVEL_0, node_name
 136         },
 137         { "pseudo", "ddi_pseudo", "timerfd",
 138             TYPE_EXACT | DRV_EXACT, ILEVEL_0, minor_name
 139         },
 140         { "pseudo", "ddi_pseudo", "tod",
 141             TYPE_EXACT | DRV_EXACT, ILEVEL_0, node_name
 142         },
 143         { "pseudo", "ddi_pseudo", "envctrl(two)?",
 144             TYPE_EXACT | DRV_RE, ILEVEL_1, minor_name,
 145         },
 146         { "pseudo", "ddi_pseudo", "fcode",
 147             TYPE_EXACT | DRV_RE, ILEVEL_0, minor_name,