]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Added type for socket
authorKen Barber <ken@bob.sh>
Fri, 22 Feb 2013 15:08:19 +0000 (15:08 +0000)
committerKen Barber <ken@bob.sh>
Fri, 22 Feb 2013 15:08:19 +0000 (15:08 +0000)
Signed-off-by: Ken Barber <ken@bob.sh>
lib/puppet/type/firewall.rb
spec/fixtures/iptables/conversion_hash.rb

index 06b82fc3a49eaa336f288071b1fa0dd8ebcb4362..942120b531e30d1881e06dfc21991a20ea26025b 100644 (file)
@@ -34,6 +34,7 @@ Puppet::Type.newtype(:firewall) do
   feature :mark, "Set the netfilter mark value associated with the packet"
   feature :tcp_flags, "The ability to match on particular TCP flag settings"
   feature :pkttype, "Match a packet type"
+  feature :socket, "Match open sockets"
 
   # provider specific features
   feature :iptables, "The provider provides iptables features."
@@ -535,6 +536,15 @@ Puppet::Type.newtype(:firewall) do
     newvalues(:unicast, :broadcast, :multicast)
   end
 
+  newproperty(:socket, :required_features => :socket) do
+    desc <<-EOS
+      If true, matches if an open socket can be found by doing a coket lookup
+      on the packet.
+    EOS
+
+    newvalues(:true, :false)
+  end
+
   newparam(:line) do
     desc <<-EOS
       Read-only property for caching the rule line.
index f416462eaef1133366d19d38427e65fc689f8537..294e4a12f1c01943763d3476defdb46ce05881ff 100644 (file)
@@ -660,6 +660,6 @@ HASH_TO_ARGS = {
       :chain => 'PREROUTING',
       :socket => true,
     },
-    :args => ['-t', :mangle, '-m', 'socket', '-j', 'ACCEPT'],
+    :args => ['-t', :mangle, '-p', :tcp, '-m', 'socket', '-m', 'comment', '--comment', '050 socket option', '-j', 'ACCEPT'],
   },
 }