From a86821ca405387ce575d1aa843c972c0fa4d9062 Mon Sep 17 00:00:00 2001
From: Ken Barber <ken@bob.sh>
Date: Sun, 25 Mar 2012 03:07:36 +0100
Subject: [PATCH] (#11305) Add tests for VLAN support for iniface/outiface

This adds tests generally for iniface and outiface, and includes examples
of interfaces with VLAN's to support that change.
---
 spec/fixtures/iptables/conversion_hash.rb | 56 +++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/spec/fixtures/iptables/conversion_hash.rb b/spec/fixtures/iptables/conversion_hash.rb
index 4c7dde4..4b95558 100644
--- a/spec/fixtures/iptables/conversion_hash.rb
+++ b/spec/fixtures/iptables/conversion_hash.rb
@@ -178,6 +178,42 @@ ARGS_TO_HASH = {
       :set_mark => '1000',
     }
   },
+  'iniface_1' => {
+    :line => '-A INPUT -i eth0 -m comment --comment "060 iniface" -j DROP',
+    :table => 'filter',
+    :params => {
+      :action => 'drop',
+      :chain => 'INPUT',
+      :iniface => 'eth0',
+    },
+  },
+  'iniface_with_vlans_1' => {
+    :line => '-A INPUT -i eth0.234 -m comment --comment "060 iniface" -j DROP',
+    :table => 'filter',
+    :params => {
+      :action => 'drop',
+      :chain => 'INPUT',
+      :iniface => 'eth0.234',
+    },
+  },
+  'outiface_1' => {
+    :line => '-A OUTPUT -o eth0 -m comment --comment "060 iniface" -j DROP',
+    :table => 'filter',
+    :params => {
+      :action => 'drop',
+      :chain => 'OUTPUT',
+      :outiface => 'eth0',
+    },
+  },
+  'outiface_with_vlans_1' => {
+    :line => '-A OUTPUT -o eth0.234 -m comment --comment "060 iniface" -j DROP',
+    :table => 'filter',
+    :params => {
+      :action => 'drop',
+      :chain => 'OUTPUT',
+      :outiface => 'eth0.234',
+    },
+  },
 }
 
 # This hash is for testing converting a hash to an argument line.
@@ -368,4 +404,24 @@ HASH_TO_ARGS = {
     },
     :args => ['-t', :mangle, '-p', :tcp, '-m', 'comment', '--comment', '058 set-mark 1000', '-j', 'MARK', '--set-mark', '0x3e8'],
   },
+  'outiface_1' => {
+    :params => {
+      :name => '060 outiface',
+      :table => 'filter',
+      :action => 'drop',
+      :chain => 'OUTPUT',
+      :outiface => 'eth0',
+    },
+    :args => ["-t", :filter, "-o", "eth0", "-p", :tcp, "-m", "comment", "--comment", "060 outiface", "-j", "DROP"],
+  },
+  'outiface_with_vlans_1' => {
+    :params => {
+      :name => '060 outiface',
+      :table => 'filter',
+      :action => 'drop',
+      :chain => 'OUTPUT',
+      :outiface => 'eth0.234',
+    },
+    :args => ["-t", :filter, "-o", "eth0.234", "-p", :tcp, "-m", "comment", "--comment", "060 outiface", "-j", "DROP"],
+  },
 }
-- 
2.45.2