Skip to content

Commit

Permalink
Merge pull request #916 from akerl-unpriv/feature/cgroup-support
Browse files Browse the repository at this point in the history
Add support for cgroup arg
  • Loading branch information
sanfrancrisko authored May 6, 2020
2 parents c05928b + c97f04e commit 8ba878f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,10 @@ Assign this packet to zone id and only have lookups done in that zone.

Invoke the nf_conntrack_xxx helper module for this packet.

##### `cgroup`

Matches against the net_cls cgroup ID of the packet.

#### Parameters

The following parameters are available in the `firewall` type.
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/provider/firewall/iptables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
ipvs: '-m ipvs --ipvs',
zone: '--zone',
helper: '--helper',
cgroup: '-m cgroup --cgroup',
}

# These are known booleans that do not take a value, but we want to munge
Expand Down Expand Up @@ -344,7 +345,8 @@ def munge_resource_map_from_resource(resource_map_original, compare)
:month_days, :week_days, :date_start, :date_stop, :time_contiguous, :kernel_timezone,
:src_cc, :dst_cc, :hashlimit_upto, :hashlimit_above, :hashlimit_name, :hashlimit_burst,
:hashlimit_mode, :hashlimit_srcmask, :hashlimit_dstmask, :hashlimit_htable_size,
:hashlimit_htable_max, :hashlimit_htable_expire, :hashlimit_htable_gcinterval, :bytecode, :ipvs, :zone, :helper, :rpfilter, :name
:hashlimit_htable_max, :hashlimit_htable_expire, :hashlimit_htable_gcinterval, :bytecode, :ipvs, :zone, :helper, :cgroup,
:rpfilter, :name
]

def insert
Expand Down
6 changes: 6 additions & 0 deletions lib/puppet/type/firewall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,12 @@ def should_to_s(value)
PUPPETCODE
end

newproperty(:cgroup) do
desc <<-PUPPETCODE
Matches against the net_cls cgroup ID of the packet.
PUPPETCODE
end

autorequire(:firewallchain) do
reqs = []
protocol = nil
Expand Down
7 changes: 7 additions & 0 deletions spec/fixtures/iptables/conversion_hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,13 @@
produce_warning: true,
params: {},
},
'cgroup_matching_1' => {
line: '-A INPUT -m cgroup --cgroup "0x100001"',
table: 'filter',
params: {
cgroup: '0x100001',
},
},
}.freeze

# This hash is for testing converting a hash to an argument line.
Expand Down

0 comments on commit 8ba878f

Please sign in to comment.