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
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')
-rw-r--r--dev-python/python-iptables/Manifest2
-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
-rw-r--r--dev-python/python-iptables/metadata.xml22
-rw-r--r--dev-python/python-iptables/python-iptables-0.8.0.ebuild42
-rw-r--r--dev-python/python-iptables/python-iptables-0.9.0.ebuild37
7 files changed, 376 insertions, 0 deletions
diff --git a/dev-python/python-iptables/Manifest b/dev-python/python-iptables/Manifest
new file mode 100644
index 00000000000..b1bf9aa6356
--- /dev/null
+++ b/dev-python/python-iptables/Manifest
@@ -0,0 +1,2 @@
+DIST python-iptables-0.8.0.tar.gz 38815 SHA256 7a80507fafdfe0448f604678e127b7dc6236dc7fe61771b3b56fd8199464ac46 SHA512 8cc3a88f1f101614597ad6e7712dd229e08b9d5fb1fc0383142746faad7f9e265ccdb6d036948bbdbf39c9021250ab98e7de36c7dc78e231f581d783431f5510 WHIRLPOOL 36ab036e4a30be4006c00bc605855c29382545ab19098af49abeb2eca0f91de5cd5608596e4d89b6efd013df58b740d886e2e362e6d0cc4aa7905afe7a7d0e50
+DIST python-iptables-0.9.0.tar.gz 72999 SHA256 80eee356beb3cfbe378a214719c5756bb665f9edfa04cd75e3a32e6e18a1f484 SHA512 5cffc83f496876346faa5b33a45be565fab2da41d25f9793db0788a80cb6835b33f474008febee8002d7af6fb052262881326adf6d69592aa96d750b2f921bd4 WHIRLPOOL 18872e6b7a3016cb2449bb1195fce874dee1d62df2aaa2bbea605f3055bf18e6c298d1dd14da9b1cb34196477470be1cdf60255df5521b734b052a3a88247ea0
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 00000000000..fb9d601ceaa
--- /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 00000000000..469fe5d97a6
--- /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 00000000000..8359bf5b4c0
--- /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
+
diff --git a/dev-python/python-iptables/metadata.xml b/dev-python/python-iptables/metadata.xml
new file mode 100644
index 00000000000..a46ccb914a0
--- /dev/null
+++ b/dev-python/python-iptables/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>python</herd>
+ <longdescription lang="en">
+ Python Bindings for IPtables: Iptables is the tool that is used to manage netfilter,
+ the standard packet filtering and manipulation framework under Linux. As the iptables
+ manpage puts it: Iptables is used to set up, maintain, and inspect the tables of IPv4
+ packet filter rules in the Linux kernel. Several different tables may be defined.
+ Each table contains a number of built-in chains and may also contain user-defined
+ chains. Each chain is a list of rules which can match a set of packets. Each rule
+ specifies what to do with a packet that matches. This is called a target, which may be
+ a jump to a user-defined chain in the same table. Python-iptables provides python
+ bindings to iptables under Linux. Interoperability with iptables is achieved via
+ using the iptables C libraries (libiptc, libxtables, and the iptables extensions), not
+ calling the iptables binary and parsing its output.
+ </longdescription>
+ <upstream>
+ <remote-id type="pypi">python-iptables</remote-id>
+ <remote-id type="github">ldx/python-iptables</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-python/python-iptables/python-iptables-0.8.0.ebuild b/dev-python/python-iptables/python-iptables-0.8.0.ebuild
new file mode 100644
index 00000000000..b2929e7c7fe
--- /dev/null
+++ b/dev-python/python-iptables/python-iptables-0.8.0.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+inherit distutils-r1
+
+DESCRIPTION="Python bindings for iptables"
+HOMEPAGE="https://github.com/ldx/python-iptables"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+
+DEPEND="net-firewall/iptables
+ doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"
+RDEPEND="${DEPEND}"
+
+# tests manipulate live iptables rules, so disable them by default
+RESTRICT=test
+
+python_prepare_all() {
+ # Prevent un-needed d'loading during doc build
+ sed -e "s/, 'sphinx.ext.intersphinx'//" -i doc/conf.py || die
+ distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+ use doc && emake -C doc html
+}
+
+python_test() {
+ ${PYTHON} test.py || die "tests fail with ${EPYTHON}"
+}
+
+python_install_all() {
+ use doc && local HTML_DOCS=( doc/_build/html/. )
+ distutils-r1_python_install_all
+}
diff --git a/dev-python/python-iptables/python-iptables-0.9.0.ebuild b/dev-python/python-iptables/python-iptables-0.9.0.ebuild
new file mode 100644
index 00000000000..3c30722be9a
--- /dev/null
+++ b/dev-python/python-iptables/python-iptables-0.9.0.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+inherit distutils-r1
+
+DESCRIPTION="Python bindings for iptables"
+HOMEPAGE="https://github.com/ldx/python-iptables"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+
+DEPEND="net-firewall/iptables
+ doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"
+RDEPEND="${DEPEND}"
+
+# tests manipulate live iptables rules, so disable them by default
+
+python_prepare_all() {
+ # Prevent un-needed d'loading during doc build
+ sed -e "s/, 'sphinx.ext.intersphinx'//" -i doc/conf.py || die
+ distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+ use doc && emake -C doc html
+}
+
+python_install_all() {
+ use doc && local HTML_DOCS=( doc/_build/html/. )
+ distutils-r1_python_install_all
+}