]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
add physdev support
authorAron Parsons <parsonsa@bit-sys.com>
Fri, 26 Sep 2014 20:58:05 +0000 (16:58 -0400)
committerJonathan Tripathy <jonathan.tripathy@puppetlabs.com>
Sun, 18 Jan 2015 23:01:21 +0000 (15:01 -0800)
rebased from https://github.com/puppetlabs/puppetlabs-firewall/pull/82

lib/puppet/provider/firewall/ip6tables.rb
lib/puppet/provider/firewall/iptables.rb
lib/puppet/type/firewall.rb

index ce4b5b46db8aed19eb9e815a0961d94ba1d46173..9139045a8b3363e212bc8e26b8679ac009a724b5 100644 (file)
@@ -119,6 +119,7 @@ Puppet::Type.type(:firewall).provide :ip6tables, :parent => :iptables, :source =
     :toports          => "--to-ports",
     :tosource         => "--to-source",
     :uid              => "-m owner --uid-owner",
+    :bridge           => "-m physdev",
   }
 
   # These are known booleans that do not take a value, but we want to munge
index c8429074d651b562998ed6c5d6fed08113b42739..56c869a83a78b234c65edf884626903f4a440bad 100644 (file)
@@ -105,6 +105,7 @@ Puppet::Type.type(:firewall).provide :iptables, :parent => Puppet::Provider::Fir
     :tosource         => "--to-source",
     :to               => "--to",
     :uid              => "-m owner --uid-owner",
+    :bridge           => "-m physdev",
   }
 
   # These are known booleans that do not take a value, but we want to munge
index 79a94a9e09da19932ab8794c554281736639973b..67060c3e92b96ef66f4dd4a31987f2544d643118 100644 (file)
@@ -1033,6 +1033,19 @@ Puppet::Type.newtype(:firewall) do
     newvalues(/^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$/i)
   end
 
+  newproperty(:bridge, :required_features => :iptables) do
+    desc <<-EOS
+      Match if the packet is being bridged.
+    EOS
+    munge do |value|
+      if ! value.to_s.start_with?("--")
+        "--" + value.to_s
+      else
+        value
+      end
+    end
+  end
+
   autorequire(:firewallchain) do
     reqs = []
     protocol = nil
@@ -1191,5 +1204,11 @@ Puppet::Type.newtype(:firewall) do
       self.fail "Parameter 'stat_probability' requires 'stat_mode' to be set to 'random'"
     end
 
+    if value(:bridged)
+      unless value(:chain).to_s =~ /FORWARD/
+        self.fail "Parameter isbridged only applies to the FORWARD chain"
+      end
+    end
+
   end
 end