Révision e846c98b
simplerule: Allow multiple oifname/iifname
REFERENCE.md | ||
---|---|---|
2400 | 2400 |
|
2401 | 2401 |
##### <a name="-nftables--simplerule--iifname"></a>`iifname` |
2402 | 2402 |
|
2403 |
Data type: `Optional[String[1]]`
|
|
2403 |
Data type: `Variant[Array[String[1]],String[1]]`
|
|
2404 | 2404 |
|
2405 | 2405 |
Optional filter for the incoming interface |
2406 | 2406 |
|
2407 |
Default value: `undef`
|
|
2407 |
Default value: `[]`
|
|
2408 | 2408 |
|
2409 | 2409 |
##### <a name="-nftables--simplerule--oifname"></a>`oifname` |
2410 | 2410 |
|
2411 |
Data type: `Optional[String[1]]`
|
|
2411 |
Data type: `Variant[Array[String[1]],String[1]]`
|
|
2412 | 2412 |
|
2413 | 2413 |
Optional filter for the outgoing interface |
2414 | 2414 |
|
2415 |
Default value: `undef`
|
|
2415 |
Default value: `[]`
|
|
2416 | 2416 |
|
2417 | 2417 |
## Data types |
2418 | 2418 |
|
manifests/simplerule.pp | ||
---|---|---|
72 | 72 |
Optional[Nftables::Port] $sport = undef, |
73 | 73 |
Optional[Nftables::Addr] $saddr = undef, |
74 | 74 |
Boolean $counter = false, |
75 |
Optional[String[1]] $iifname = undef,
|
|
76 |
Optional[String[1]] $oifname = undef,
|
|
75 |
Variant[Array[String[1]],String[1]] $iifname = [],
|
|
76 |
Variant[Array[String[1]],String[1]] $oifname = [],
|
|
77 | 77 |
) { |
78 | 78 |
if $dport and !$proto { |
79 | 79 |
fail('Specifying a transport protocol via $proto is mandatory when passing a $dport') |
... | ... | |
96 | 96 |
'saddr' => $saddr, |
97 | 97 |
'set_type' => $set_type, |
98 | 98 |
'sport' => $sport, |
99 |
'iifname' => $iifname,
|
|
100 |
'oifname' => $oifname,
|
|
99 |
'iifname' => [$iifname].flatten,
|
|
100 |
'oifname' => [$oifname].flatten,
|
|
101 | 101 |
} |
102 | 102 |
), |
103 | 103 |
order => $order, |
templates/simplerule.epp | ||
---|---|---|
7 | 7 |
Optional[Nftables::Addr] $saddr, |
8 | 8 |
String $set_type, |
9 | 9 |
Optional[Nftables::Port] $sport, |
10 |
Optional[String[1]] $iifname,
|
|
11 |
Optional[String[1]] $oifname,
|
|
10 |
Array[String[1]] $iifname,
|
|
11 |
Array[String[1]] $oifname,
|
|
12 | 12 |
| -%> |
13 | 13 |
<%- if $proto { |
14 | 14 |
$_proto = $proto ? { |
... | ... | |
71 | 71 |
} else { |
72 | 72 |
$_counter = undef |
73 | 73 |
} -%> |
74 |
<%- if $iifname { |
|
75 |
$_iifname = "iifname \"${iifname}\"" |
|
76 |
} else { |
|
74 |
<%- if empty($iifname) { |
|
77 | 75 |
$_iifname = undef |
78 |
} -%> |
|
79 |
<%- if $oifname { |
|
80 |
$_oifname = "oifname \"${oifname}\"" |
|
81 | 76 |
} else { |
77 |
$iifdata = $iifname.map |String[1] $interface| { "\"${interface}\"" }.join(', ') |
|
78 |
$_iifname = "iifname { ${iifdata} }" |
|
79 |
} -%> |
|
80 |
<%- if empty($oifname) { |
|
82 | 81 |
$_oifname = undef |
82 |
} else { |
|
83 |
$oifdata = $oifname.map |String[1] $interface| { "\"${interface}\"" }.join(', ') |
|
84 |
$_oifname = "oifname { ${oifdata} }" |
|
83 | 85 |
} -%> |
84 | 86 |
<%= regsubst(strip([$_ip_version_filter, $_iifname, $_oifname, $_src_port, $_dst_port, $_src_hosts, $_dst_hosts, $_counter, $action, $_comment].join(' ')), '\s+', ' ', 'G') -%> |
Formats disponibles : Unified diff