Skip to content

Commit

Permalink
Merge pull request #1201 from puppetlabs/MODULES-11449-ipv6-nat-chain…
Browse files Browse the repository at this point in the history
…-issue

(MODULES-11449) - Fix for IPv6 NAT chain
  • Loading branch information
Ramesh7 committed Mar 20, 2024
2 parents ac201ca + b1f5e4d commit 169e693
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/puppet/provider/firewallchain/firewallchain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def self.verify(_is, should)
raise ArgumentError, 'PREROUTING, POSTROUTING, INPUT, FORWARD and OUTPUT are the only inbuilt chains that can be used in table \'mangle\'' if %r{^(BROUTING)$}.match?(should[:chain])
when 'nat'
raise ArgumentError, 'PREROUTING, POSTROUTING, INPUT, and OUTPUT are the only inbuilt chains that can be used in table \'nat\'' if %r{^(BROUTING|FORWARD)$}.match?(should[:chain])
raise ArgumentError, 'table nat isn\'t valid in IPv6. You must specify \':IPv4\' as the name suffix' if %r{^(IP(v6)?)?$}.match?(should[:protocol])
when 'raw'
raise ArgumentError, 'PREROUTING and OUTPUT are the only inbuilt chains in the table \'raw\'' if %r{^(POSTROUTING|BROUTING|INPUT|FORWARD)$}.match?(should[:chain])
when 'broute'
Expand Down
12 changes: 12 additions & 0 deletions spec/acceptance/firewallchain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@
end
end
end

context 'with NAT chain' do
pp3 = <<-PUPPETCODE
firewallchain { 'MY_CHAIN:nat:IPv6':
ensure => present,
}
PUPPETCODE
it 'applies cleanly' do
# Run it twice and test for idempotency
idempotent_apply(pp3)
end
end
end

# XXX purge => false is not yet implemented
Expand Down
4 changes: 0 additions & 4 deletions spec/unit/puppet/provider/firewallchain/firewallchain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,6 @@
should: { name: 'FORWARD:nat:IPv4', chain: 'FORWARD', table: 'nat', protocol: 'IPv4', ensure: 'present', policy: 'accept' },
error: 'PREROUTING, POSTROUTING, INPUT, and OUTPUT are the only inbuilt chains that can be used in table \'nat\''
},
{
should: { name: 'PREROUTING:nat:IPv6', chain: 'PREROUTING', table: 'nat', protocol: 'IPv6', ensure: 'present', policy: 'accept' },
error: 'table nat isn\'t valid in IPv6. You must specify \':IPv4\' as the name suffix'
},
{
should: { name: 'INPUT:raw:IPv4', chain: 'INPUT', table: 'raw', protocol: 'IPv4', ensure: 'present', policy: 'accept' },
error: 'PREROUTING and OUTPUT are the only inbuilt chains in the table \'raw\''
Expand Down

0 comments on commit 169e693

Please sign in to comment.