Home | History | Annotate | Line # | Download | only in npftest
      1  1.18       joe # $NetBSD: npftest.conf,v 1.18 2025/08/20 11:03:59 joe Exp $
      2   1.1     rmind 
      3   1.1     rmind $ext_if = "npftest0"
      4   1.1     rmind $int_if = "npftest1"
      5   1.1     rmind 
      6   1.9     rmind set portmap.min_port 1024
      7   1.9     rmind set portmap.max_port 65535
      8   1.9     rmind 
      9   1.1     rmind #
     10   1.1     rmind # RFC 5737
     11   1.1     rmind #
     12   1.1     rmind 
     13   1.1     rmind $pub_ip1 = 192.0.2.1
     14   1.1     rmind $pub_ip2 = 192.0.2.2
     15   1.4     rmind $pub_ip3 = 192.0.2.3
     16   1.1     rmind 
     17   1.1     rmind $local_ip1 = 10.1.1.1
     18   1.1     rmind $local_ip2 = 10.1.1.2
     19   1.1     rmind $local_ip3 = 10.1.1.3
     20   1.1     rmind $local_ip4 = 10.1.1.4
     21  1.18       joe $local_ip5 = 10.1.1.5
     22  1.18       joe 
     23  1.13       joe $Kojo = 1001
     24  1.13       joe $wheel = 20
     25   1.1     rmind 
     26   1.1     rmind $local_net = { 10.1.1.0/24 }
     27   1.1     rmind $ports = { 8000, 9000 }
     28   1.1     rmind 
     29  1.14       joe #
     30  1.14       joe # RFC 7042
     31  1.14       joe #
     32  1.14       joe # 00:00:5E:00:53:00 - 00:00:5E:00:53:FF
     33  1.14       joe $mac1 = 00:00:5E:00:53:00
     34  1.14       joe $mac2 = 00:00:5E:00:53:01
     35  1.14       joe $mac3 = 00:00:5E:00:53:02
     36  1.16       joe $nested_mac4 = { 00:00:5E:00:53:03, 00:00:5E:00:53:04, 00:00:5E:00:53:05 }
     37  1.14       joe 
     38  1.18       joe #
     39  1.18       joe # PR bin/59511
     40  1.18       joe # NPF doesn't extract some values from nested variables
     41  1.18       joe $home = { 192.168.100.5, 192.168.100.8 }
     42  1.18       joe $office = { 192.168.64.3, 192.168.64.9 }
     43  1.18       joe $blocklist = { $home, $office }
     44  1.18       joe 
     45   1.4     rmind map $ext_if static $local_ip3 <-> $pub_ip3
     46   1.1     rmind map $ext_if dynamic $local_ip2 <-> $pub_ip2
     47   1.1     rmind map $ext_if dynamic $local_net -> $pub_ip1
     48   1.1     rmind map $ext_if dynamic $local_ip1 port 6000 <- $pub_ip1 port 8000
     49   1.1     rmind 
     50   1.6     rmind $net6_inner = fd01:203:405::/48
     51   1.6     rmind $net6_outer = 2001:db8:1::/48
     52   1.6     rmind 
     53  1.10  riastrad # Example of multiple addresses with a common 32-bit word, taken from
     54  1.10  riastrad # PR bin/55403: npfctl miscompiles IPv6 rules.
     55  1.12  riastrad $net6_pr55403 = { fe80::1, fe80::1000:0:0/95, fe80::2, fe80::2000:0:0/96, fe80::3, fe80::3000:0:0/97 }
     56  1.10  riastrad 
     57   1.6     rmind $net_a = 10.100.0.0/16
     58   1.6     rmind $net_b = 10.255.0.0/16
     59   1.6     rmind 
     60   1.5     rmind map $ext_if static algo npt66 $net6_inner <-> $net6_outer
     61   1.6     rmind map $ext_if static algo netmap $net_a <-> $net_b
     62   1.8     rmind map ruleset "map:some-daemon" on $ext_if
     63   1.5     rmind 
     64   1.3     rmind group "ext" on $ext_if {
     65   1.4     rmind 	pass out final from $local_ip3
     66   1.4     rmind 	pass in final to $pub_ip3
     67  1.15       joe 	pass in final from $local_ip4 port 8000-10000 user $Kojo group $wheel
     68  1.13       joe 	block out final to 127.0.0.1 user > $Kojo group 1 >< $wheel
     69   1.4     rmind 
     70   1.5     rmind 	pass out final from $net6_inner
     71   1.5     rmind 	pass in final to $net6_outer
     72   1.5     rmind 
     73   1.6     rmind 	pass out final from $net_a
     74   1.6     rmind 	pass in final to $net_b
     75   1.6     rmind 
     76   1.1     rmind 	pass stateful out final proto tcp flags S/SA all
     77   1.1     rmind 	pass stateful out final from $local_net
     78   1.1     rmind 	pass stateful in final to any port $ports
     79   1.1     rmind 	pass stateful in final proto icmp all
     80  1.10  riastrad 
     81   1.1     rmind 	block all
     82   1.1     rmind }
     83   1.1     rmind 
     84   1.3     rmind group "int" on $int_if {
     85   1.3     rmind 	ruleset "test-rules"
     86  1.17   mlelstv 	block in final from $local_ip3
     87   1.1     rmind 	pass stateful out final to $local_ip2
     88   1.1     rmind 	pass out final to $local_ip3
     89   1.1     rmind 	block final to $local_ip4
     90  1.11  riastrad 
     91  1.11  riastrad 	pass in final family inet6 proto udp from $net6_pr55403
     92  1.11  riastrad 	pass in final family inet6 proto udp from ! $net6_pr55403 to $net6_pr55403
     93  1.18       joe 
     94  1.18       joe 	block in final from $blocklist to $local_ip5
     95   1.1     rmind }
     96   1.1     rmind 
     97  1.14       joe group "ext2" on $int_if layer-2 {
     98  1.14       joe 	ruleset "l2-ruleset" layer-2
     99  1.14       joe 	pass ether in final from $mac1 to $mac2 type Ex86DD
    100  1.14       joe 	block ether in final from $mac2
    101  1.14       joe 	pass ether out final to $mac3 type Ex809B
    102  1.16       joe 	pass ether in final from $nested_mac4
    103  1.14       joe }
    104  1.14       joe 
    105   1.3     rmind group default {
    106   1.1     rmind 	block all
    107   1.1     rmind }
    108  1.14       joe 
    109  1.14       joe group default layer-2 {
    110  1.14       joe 	block ether all
    111  1.14       joe }
    112