]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Fix handling of chain names that contain -f
authorMax Vozeler <max.vozeler@amadeus.com>
Mon, 16 Nov 2015 13:01:35 +0000 (14:01 +0100)
committerMax Vozeler <max.vozeler@amadeus.com>
Wed, 9 Dec 2015 12:09:44 +0000 (13:09 +0100)
lib/puppet/provider/firewall/iptables.rb
spec/fixtures/iptables/conversion_hash.rb

index 27c0b362e04997b5b7c461ada810ab09e4d2989d..5835dea3e97e795d83a9142bd914fc685a6ff13e 100644 (file)
@@ -356,7 +356,7 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
         # -f requires special matching:
         # only replace those -f that are not followed by an l to
         # distinguish between -f and the '-f' inside of --tcp-flags.
-        values = values.sub(/-f(?!l)(?=.*--comment)/, '-f true')
+        values = values.sub(/\s-f(?!l)(?=.*--comment)/, ' -f true')
       else
         values = values.sub(/#{resource_map[bool]}/, "#{resource_map[bool]} true")
       end
index ac9ba9a9647bf811d25b24b6971bf7be2809047a..bbdff8cc8786e7cadaffe7c098d197b66678759d 100644 (file)
@@ -573,6 +573,14 @@ ARGS_TO_HASH = {
       :clamp_mss_to_pmtu => true,
     },
   },
+  'mangled_chain_name_with_-f' => {
+    :line => '-A foo-filter -p tcp -m comment --comment "068 chain name containing -f" -j ACCEPT',
+    :params => {
+      :name              => '068 chain name containing -f',
+      :action            => 'accept',
+      :chain             => 'foo-filter',
+    },
+  },
 }
 
 # This hash is for testing converting a hash to an argument line.