summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-python/python-iptables/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-python/python-iptables/files')
-rw-r--r--dev-python/python-iptables/files/python-iptables-0.2.0-tests.patch21
-rw-r--r--dev-python/python-iptables/files/python-iptables-0.3.0-conntrack-fixes.patch182
-rw-r--r--dev-python/python-iptables/files/python-iptables-fix-ctypes.patch70
3 files changed, 273 insertions, 0 deletions
diff --git a/dev-python/python-iptables/files/python-iptables-0.2.0-tests.patch b/dev-python/python-iptables/files/python-iptables-0.2.0-tests.patch
new file mode 100644
index 000000000000..fb9d601ceaa8
--- /dev/null
+++ b/dev-python/python-iptables/files/python-iptables-0.2.0-tests.patch
@@ -0,0 +1,21 @@
+diff --git a/test.py b/test.py
+index f426612..f598585 100755
+--- a/test.py
++++ b/test.py
+@@ -3,16 +3,6 @@
+
+ import sys
+
+-print "WARNING: this test will manipulate iptables rules."
+-print "Don't do this on a production machine."
+-while True:
+- print "Would you like to continue? y/n",
+- answer = raw_input()
+- if answer in "yYnN" and len(answer) == 1:
+- break
+-if answer in "nN":
+- sys.exit(0)
+-
+ from iptc.test import test_iptc, test_matches, test_targets
+
+ results = [rv for rv in [test_iptc.run_tests(), test_matches.run_tests(),
diff --git a/dev-python/python-iptables/files/python-iptables-0.3.0-conntrack-fixes.patch b/dev-python/python-iptables/files/python-iptables-0.3.0-conntrack-fixes.patch
new file mode 100644
index 000000000000..469fe5d97a69
--- /dev/null
+++ b/dev-python/python-iptables/files/python-iptables-0.3.0-conntrack-fixes.patch
@@ -0,0 +1,182 @@
+diff --git a/iptc/ip4tc.py b/iptc/ip4tc.py
+index 1efeabe..a953f41 100644
+--- a/iptc/ip4tc.py
++++ b/iptc/ip4tc.py
+@@ -460,8 +460,6 @@ class Match(IPTCModule):
+ if self._module.next is not None:
+ self._store_buffer(module)
+
+- self._check_alias(module[0], match)
+-
+ self._match_buf = (ct.c_ubyte * self.size)()
+ if match:
+ ct.memmove(ct.byref(self._match_buf), ct.byref(match), self.size)
+@@ -503,7 +501,11 @@ class Match(IPTCModule):
+ self._buffer.buffer = ct.cast(module, ct.POINTER(ct.c_ubyte))
+
+ def _final_check(self):
+- self._xt.final_check_match(self._module)
++ if self._alias is not None:
++ module = self._alias
++ else:
++ module = self._module
++ self._xt.final_check_match(module)
+
+ def _parse(self, argv, inv, entry):
+ if self._alias is not None:
+@@ -530,6 +532,7 @@ class Match(IPTCModule):
+ self._ptrptr = ct.cast(ct.pointer(self._ptr),
+ ct.POINTER(ct.POINTER(xt_entry_match)))
+ self._module.m = self._ptr
++ self._check_alias(self._module, self._module.m)
+ if self._alias is not None:
+ self._alias.m = self._ptr
+ self._update_name()
+@@ -613,8 +616,6 @@ class Target(IPTCModule):
+ else:
+ self._revision = self._module.revision
+
+- self._check_alias(module[0], target)
+-
+ self._create_buffer(target)
+
+ if self._is_standard_target():
+@@ -673,7 +674,11 @@ class Target(IPTCModule):
+ return False
+
+ def _final_check(self):
+- self._xt.final_check_target(self._module)
++ if self._alias is not None:
++ module = self._alias
++ else:
++ module = self._module
++ self._xt.final_check_target(module)
+
+ def _parse(self, argv, inv, entry):
+ if self._alias is not None:
+@@ -715,6 +720,7 @@ class Target(IPTCModule):
+ self._ptrptr = ct.cast(ct.pointer(self._ptr),
+ ct.POINTER(ct.POINTER(xt_entry_target)))
+ self._module.t = self._ptr
++ self._check_alias(self._module, self._module.t)
+ if self._alias is not None:
+ self._alias.t = self._ptr
+ self._update_name()
+diff --git a/iptc/test/test_matches.py b/iptc/test/test_matches.py
+index 69b0b01..67c37ff 100755
+--- a/iptc/test/test_matches.py
++++ b/iptc/test/test_matches.py
+@@ -298,6 +298,40 @@ class TestXTStateMatch(unittest.TestCase):
+ self.assertEquals(m.state, "RELATED,ESTABLISHED")
+
+
++class TestXTConntrackMatch(unittest.TestCase):
++ def setUp(self):
++ self.rule = iptc.Rule()
++ self.rule.src = "127.0.0.1"
++ self.rule.protocol = "tcp"
++ self.rule.target = iptc.Target(self.rule, "ACCEPT")
++
++ self.match = iptc.Match(self.rule, "conntrack")
++
++ self.chain = iptc.Chain(iptc.Table(iptc.Table.FILTER),
++ "iptc_test_conntrack")
++ self.table = iptc.Table(iptc.Table.FILTER)
++ try:
++ self.chain.flush()
++ self.chain.delete()
++ except:
++ pass
++ self.table.create_chain(self.chain)
++
++ def tearDown(self):
++ self.chain.flush()
++ self.chain.delete()
++ pass
++
++ def test_state(self):
++ self.match.ctstate = "NEW,RELATED"
++ self.rule.add_match(self.match)
++ self.chain.insert_rule(self.rule)
++ rule = self.chain.rules[0]
++ m = rule.matches[0]
++ self.assertTrue(m.name, ["conntrack"])
++ self.assertEquals(m.ctstate, "NEW,RELATED")
++
++
+ def suite():
+ suite_match = unittest.TestLoader().loadTestsFromTestCase(TestMatch)
+ suite_udp = unittest.TestLoader().loadTestsFromTestCase(TestXTUdpMatch)
+@@ -308,9 +342,11 @@ def suite():
+ suite_iprange = unittest.TestLoader().loadTestsFromTestCase(
+ TestIprangeMatch)
+ suite_state = unittest.TestLoader().loadTestsFromTestCase(TestXTStateMatch)
++ suite_conntrack = unittest.TestLoader().loadTestsFromTestCase(
++ TestXTConntrackMatch)
+ return unittest.TestSuite([suite_match, suite_udp, suite_mark,
+ suite_limit, suite_comment, suite_iprange,
+- suite_state])
++ suite_state, suite_conntrack])
+
+
+ def run_tests():
+diff --git a/iptc/test/test_targets.py b/iptc/test/test_targets.py
+index 6d83f5f..32516bd 100755
+--- a/iptc/test/test_targets.py
++++ b/iptc/test/test_targets.py
+@@ -371,6 +371,37 @@ class TestXTNotrackTarget(unittest.TestCase):
+ self.assertTrue(t.name in ["NOTRACK", "CT"])
+
+
++class TestXTCtTarget(unittest.TestCase):
++ def setUp(self):
++ self.rule = iptc.Rule()
++ self.rule.dst = "127.0.0.2"
++ self.rule.protocol = "tcp"
++ self.rule.out_interface = "eth0"
++
++ self.target = iptc.Target(self.rule, "CT")
++ self.target.notrack = "true"
++ self.rule.target = self.target
++
++ self.chain = iptc.Chain(iptc.Table(iptc.Table.RAW),
++ "iptc_test_ct")
++ try:
++ self.chain.flush()
++ self.chain.delete()
++ except:
++ pass
++ iptc.Table(iptc.Table.RAW).create_chain(self.chain)
++
++ def tearDown(self):
++ self.chain.flush()
++ self.chain.delete()
++
++ def test_ct(self):
++ self.chain.insert_rule(self.rule)
++ t = self.chain.rules[0].target
++ self.assertEquals(t.name, "CT")
++ self.assertTrue(t.notrack is not None)
++
++
+ def suite():
+ suites = []
+ suite_target = unittest.TestLoader().loadTestsFromTestCase(TestTarget)
+@@ -383,14 +414,15 @@ def suite():
+ TestIPTMasqueradeTarget)
+ suite_dnat = unittest.TestLoader().loadTestsFromTestCase(
+ TestDnatTarget)
+- suite_conntrack = unittest.TestLoader().loadTestsFromTestCase(
++ suite_notrack = unittest.TestLoader().loadTestsFromTestCase(
+ TestXTNotrackTarget)
++ suite_ct = unittest.TestLoader().loadTestsFromTestCase(TestXTCtTarget)
+ suites.extend([suite_target, suite_cluster, suite_tos])
+ if is_table_available(iptc.Table.NAT):
+ suites.extend([suite_target, suite_cluster, suite_redir, suite_tos,
+ suite_masq, suite_dnat])
+ if is_table_available(iptc.Table.RAW):
+- suites.extend([suite_conntrack])
++ suites.extend([suite_notrack, suite_ct])
+ return unittest.TestSuite(suites)
+
+
diff --git a/dev-python/python-iptables/files/python-iptables-fix-ctypes.patch b/dev-python/python-iptables/files/python-iptables-fix-ctypes.patch
new file mode 100644
index 000000000000..8359bf5b4c03
--- /dev/null
+++ b/dev-python/python-iptables/files/python-iptables-fix-ctypes.patch
@@ -0,0 +1,70 @@
+https://github.com/ldx/python-iptables/pull/59
+
+From 6c30ca04656062bf95a1039d6e4bc7440150b9bc Mon Sep 17 00:00:00 2001
+From: Tim Harder <radhermit@gmail.com>
+Date: Sat, 22 Feb 2014 01:11:40 -0800
+Subject: [PATCH 2/2] Fix return and argument types for various libiptc API
+ calls.
+
+---
+ iptc/ip4tc.py | 6 +++---
+ iptc/ip6tc.py | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/iptc/ip4tc.py b/iptc/ip4tc.py
+index a953f41..fd3fc78 100644
+--- a/iptc/ip4tc.py
++++ b/iptc/ip4tc.py
+@@ -103,7 +103,7 @@ _libiptc, _ = find_library("ip4tc", "iptc") # old iptables versions use iptc
+ class iptc(object):
+ """This class contains all libiptc API calls."""
+ iptc_init = _libiptc.iptc_init
+- iptc_init.restype = ct.c_void_p
++ iptc_init.restype = ct.POINTER(ct.c_int)
+ iptc_init.argstype = [ct.c_char_p]
+
+ iptc_free = _libiptc.iptc_free
+@@ -120,11 +120,11 @@ class iptc(object):
+
+ iptc_first_chain = _libiptc.iptc_first_chain
+ iptc_first_chain.restype = ct.c_char_p
+- iptc_first_chain.argstype = [ct.c_char_p, ct.c_void_p]
++ iptc_first_chain.argstype = [ct.c_void_p]
+
+ iptc_next_chain = _libiptc.iptc_next_chain
+ iptc_next_chain.restype = ct.c_char_p
+- iptc_next_chain.argstype = [ct.c_char_p, ct.c_void_p]
++ iptc_next_chain.argstype = [ct.c_void_p]
+
+ iptc_is_chain = _libiptc.iptc_is_chain
+ iptc_is_chain.restype = ct.c_int
+diff --git a/iptc/ip6tc.py b/iptc/ip6tc.py
+index dbf034d..10422d8 100644
+--- a/iptc/ip6tc.py
++++ b/iptc/ip6tc.py
+@@ -82,7 +82,7 @@ _libiptc, _ = find_library("ip6tc", "iptc") # old iptables versions use iptc
+ class ip6tc(object):
+ """This class contains all libip6tc API calls."""
+ iptc_init = _libiptc.ip6tc_init
+- iptc_init.restype = ct.c_void_p
++ iptc_init.restype = ct.POINTER(ct.c_int)
+ iptc_init.argstype = [ct.c_char_p]
+
+ iptc_free = _libiptc.ip6tc_free
+@@ -99,11 +99,11 @@ class ip6tc(object):
+
+ iptc_first_chain = _libiptc.ip6tc_first_chain
+ iptc_first_chain.restype = ct.c_char_p
+- iptc_first_chain.argstype = [ct.c_char_p, ct.c_void_p]
++ iptc_first_chain.argstype = [ct.c_void_p]
+
+ iptc_next_chain = _libiptc.ip6tc_next_chain
+ iptc_next_chain.restype = ct.c_char_p
+- iptc_next_chain.argstype = [ct.c_char_p, ct.c_void_p]
++ iptc_next_chain.argstype = [ct.c_void_p]
+
+ iptc_is_chain = _libiptc.ip6tc_is_chain
+ iptc_is_chain.restype = ct.c_int
+--
+1.9.0
+