1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
From cf0621ca9b7eda22832f0a0a9990e34daa3056d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?=
<umlaeute@debian.org>
Date: Fri, 28 Apr 2017 22:21:44 +0200
Subject: Backported support for v12 xtables
Debian/stretch defaults to xtables12
Closes: #860986
---
iptc/xtables.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 59 insertions(+), 3 deletions(-)
diff --git a/iptc/xtables.py b/iptc/xtables.py
index c006468..54ba0e4 100644
--- a/iptc/xtables.py
+++ b/iptc/xtables.py
@@ -411,6 +411,7 @@ class _xtables_match_v10(ct.Structure):
_xtables_match_v11 = _xtables_match_v10
+_xtables_match_v12 = _xtables_match_v10
class xtables_match(ct.Union):
@@ -424,7 +425,8 @@ class xtables_match(ct.Union):
# Apparently v8 was skipped
("v9", _xtables_match_v9),
("v10", _xtables_match_v10),
- ("v11", _xtables_match_v11)]
+ ("v11", _xtables_match_v11),
+ ("v12", _xtables_match_v12)]
class _xtables_target_v1(ct.Structure):
@@ -667,6 +669,60 @@ class _xtables_target_v10(ct.Structure):
_xtables_target_v11 = _xtables_target_v10
+class _xtables_target_v12(ct.Structure):
+ _fields_ = [("version", ct.c_char_p),
+ ("next", ct.c_void_p),
+ ("name", ct.c_char_p),
+ ("real_name", ct.c_char_p),
+ ("revision", ct.c_uint8),
+ ("ext_flags", ct.c_uint8),
+ ("family", ct.c_uint16),
+ ("size", ct.c_size_t),
+ ("userspacesize", ct.c_size_t),
+ ("help", ct.CFUNCTYPE(None)),
+ ("init", ct.CFUNCTYPE(None, ct.POINTER(xt_entry_target))),
+ # fourth parameter entry is struct ipt_entry for example
+ # int (*parse)(int c, char **argv, int invert,
+ # unsigned int *flags, const void *entry,
+ # struct xt_entry_target **target)
+ ("parse", ct.CFUNCTYPE(ct.c_int,
+ ct.POINTER(ct.c_char_p), ct.c_int,
+ ct.POINTER(ct.c_uint), ct.c_void_p,
+ ct.POINTER(ct.POINTER(
+ xt_entry_target)))),
+ ("final_check", ct.CFUNCTYPE(None, ct.c_uint)),
+ # prints out the target iff non-NULL: put space at end
+ # first parameter ip is struct ipt_ip * for example
+ ("print", ct.CFUNCTYPE(None, ct.c_void_p,
+ ct.POINTER(xt_entry_target), ct.c_int)),
+ # saves the target info in parsable form to stdout.
+ # first parameter ip is struct ipt_ip * for example
+ ("save", ct.CFUNCTYPE(None, ct.c_void_p,
+ ct.POINTER(xt_entry_target))),
+ # Print target name or alias
+ ("alias", ct.CFUNCTYPE(ct.c_char_p,
+ ct.POINTER(xt_entry_target))),
+ # pointer to list of extra command-line options
+ ("extra_opts", ct.POINTER(option)),
+
+ # introduced with the new iptables API
+ ("x6_parse", ct.CFUNCTYPE(None, ct.POINTER(xt_option_call))),
+ ("x6_fcheck", ct.CFUNCTYPE(None, ct.POINTER(xt_fcheck_call))),
+ ("x6_options", ct.POINTER(xt_option_entry)),
+
+ ('xt_xlate', ct.c_int),
+
+ # size of per-extension instance extra "global" scratch space
+ ("udata_size", ct.c_size_t),
+
+ # ignore these men behind the curtain:
+ ("udata", ct.c_void_p),
+ ("option_offset", ct.c_uint),
+ ("t", ct.POINTER(xt_entry_target)),
+ ("tflags", ct.c_uint),
+ ("used", ct.c_uint),
+ ("loaded", ct.c_uint)]
+
class xtables_target(ct.Union):
_fields_ = [("v1", _xtables_target_v1),
@@ -679,8 +735,8 @@ class xtables_target(ct.Union):
# Apparently v8 was skipped
("v9", _xtables_target_v9),
("v10", _xtables_target_v10),
- ("v11", _xtables_target_v11)]
-
+ ("v11", _xtables_target_v11),
+ ("v12", _xtables_target_v12)]
class XTablesError(Exception):
"""Raised when an xtables call fails for some reason."""
|