]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
match rules with -m ttl
authorPavel Pulec <pulecp@gmail.com>
Thu, 3 Mar 2016 16:08:43 +0000 (17:08 +0100)
committerPavel Pulec <pulecp@gmail.com>
Thu, 3 Mar 2016 16:15:00 +0000 (17:15 +0100)
lib/puppet/provider/firewall/iptables.rb
spec/acceptance/resource_cmd_spec.rb

index ac0161354c4a6724b3ea0a7faf9526d8f85b6dca..dd92362ac8d34686ba9935150086e21fc5a4bfda 100644 (file)
@@ -339,6 +339,8 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
     # PRE-PARSE CLUDGING
     ####################
 
+    # The match for ttl
+    values = values.gsub(/(!\s+)?-m ttl (!\s+)?--ttl-(eq|lt|gt) [0-9]+/, '')
     # --tcp-flags takes two values; we cheat by adding " around it
     # so it behaves like --comment
     values = values.gsub(/(!\s+)?--tcp-flags (\S*) (\S*)/, '--tcp-flags "\1\2 \3"')
index 76a106e2ee11208cb8076889b81fae04665eb039..19fd3af1f87455f7af887661b0298799659c94b9 100644 (file)
@@ -150,6 +150,21 @@ describe 'puppet resource firewall command:', :unless => UNSUPPORTED_PLATFORMS.i
     end
   end
 
+  context 'accepts rules with -m ttl' do
+    before :all do
+      iptables_flush_all_tables
+      shell('iptables -t nat -A OUTPUT -s 10.0.0.0/8 -p tcp -m ttl ! --ttl-eq 42 -j REDIRECT --to-ports 12299')
+    end
+
+    it do
+      shell('puppet resource firewall') do |r|
+        r.exit_code.should be_zero
+        # don't check stdout, testing preexisting rules, output is normal
+        r.stderr.should be_empty
+      end
+    end
+  end
+
   # version of iptables that ships with el5 doesn't work with the
   # ip6tables provider
   if default['platform'] !~ /el-5/ and default['platform'] !~ /sles-10/