Skip to content

Unable to traverse tables with iptables 1.4.13 #19

Closed

Description

@f34rdotcom

I was also not able to get the modules to load. I modified the code to load like this
_libiptc = ct.CDLL("libip4tc.so", use_errno=True)

I am using an custom embeded distroy with a 3.3.7 kernel. This may be the problem
but I thought I should check as you mentioned that the API changed in 1.4 and needed more testing to confirm.

Below is the exception I get its possible the lines are off by a few from master branch because of my temp hack to get the module to load.

I plan on digging deeper into the C calls but it will likely take a lot longer to figure the API
out and see what could be causing it. Best I can tell _libiptc.iptc_first_rule is return 0
when given what seem to be valid args.

************ test code *************

!/usr/bin/python

import iptc

for chain in iptc.Table(iptc.Table.FILTER).chains:
print vars(chain)

table = iptc.Table(iptc.Table.FILTER)
inp = iptc.Chain(table, "INPUT")
for r in inp.rules:
print r.src, "->", r.dst, "L4:", r.protocol,
for m in r.matches:
print "match:", m.name,
print "target:", r.target.name


==================== iptables ===================
iptables -L INPUT
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
eth0_in all -- anywhere anywhere
eth1_in all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
Reject all -- anywhere anywhere
LOG all -- anywhere anywhere LOG level info prefix "Shorewall:INPUT:REJECT:"
reject all -- anywhere anywhere

==================== test code results ==================
./test.py
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'INPUT'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'FORWARD'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'OUTPUT'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'Drop'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'Reject'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'all2all'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'dmz22all'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'dmz22fw'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'dmz22net1'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'dropBcast'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'dropInvalid'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'dropNotSyn'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'dynamic'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'eth0_fwd'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'eth0_in'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'eth0_out'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'eth1_fwd'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'eth1_in'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'eth1_out'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'fw2dmz2'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'fw2net1'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'logdrop'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'logreject'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'net12dmz2'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'reject'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'shorewall'}
{'table': <iptc.ip4tc.Table object at 0x7fafff87a890>, 'name': 'smurfs'}
Traceback (most recent call last):
File "./test.py", line 10, in
for r in inp.rules:
File "/usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 1195, in _get_rules
rules.append(Rule(rule, self))
File "/usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 682, in init
self.rule = entry
File "/usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 1060, in _set_rule
self.target = Target(self, target=target)
File "/usr/lib/python2.7/site-packages/iptc/ip4tc.py", line 513, in init
raise XTablesError("can't find target %s" % (name))
iptc.xtables.XTablesError: can't find target

Activity

  1. f34rdotcom commented on Mar 3, 2013

    @f34rdotcom
    Author

    I managed to eliminate the loading issue by adding ldconfig to my test system but I still get errors.
    This is the results of the test code. I probably dont have some of the ipv6 iptable kernel modules
    loaded so some of these errors seem reasonable. But the iterator and others I just dont get why they specifically are having issues.

    Re
    Sean M

    test_table6 (iptc.test.test_iptc.TestTable6) ... ERROR
    test_refresh (iptc.test.test_iptc.TestTable) ... ERROR
    test_table (iptc.test.test_iptc.TestTable) ... ok
    test_builtin_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain_counters (iptc.test.test_iptc.TestChain) ... ok
    test_chain_policy (iptc.test.test_iptc.TestChain) ... ok
    test_chains (iptc.test.test_iptc.TestChain) ... ok
    test_create_chain (iptc.test.test_iptc.TestChain) ... ERROR
    test_is_chain (iptc.test.test_iptc.TestChain) ... ok
    test_rule_address (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule6) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule6) ... ERROR
    test_rule_address (iptc.test.test_iptc.TestRule) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule) ... ok
    test_rule_fragment (iptc.test.test_iptc.TestRule) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule) ... ERROR

  2. ldx commented on Mar 3, 2013

    @ldx
    Owner

    First of all, I just committed a fix regarding rule iteration in chains - can you pull it and rerun your tests?

    If anything is still failing, can you also post the exceptions from the test suite? Thanks.

  3. f34rdotcom commented on Mar 3, 2013

    @f34rdotcom
    Author

    Nice. I see you are active on this project. I have been wrapping iptables in bash scripts and think this will make it much more efficient so THANKS for this cool project.

    Again I am running on a custom thin linux os based upon linux from scratch and buildroot so it may be causing problems but I can adjust build as needed to make it work. I added ldconfig that seemed to help python
    find modules. I am using CodeSourcery toolchain.

    lsmod
    xt_u32 1272 0 - Live 0xffffffffa004a000
    iptable_raw 1048 0 - Live 0xffffffffa0046000
    xt_mark 952 0 - Live 0xffffffffa0042000
    xt_iprange 1368 0 - Live 0xffffffffa003e000
    xt_multiport 1496 4 - Live 0xffffffffa003a000
    xt_conntrack 2648 0 - Live 0xffffffffa0036000
    iptable_nat 3309 1 - Live 0xffffffffa0032000
    nf_nat 12812 1 iptable_nat, Live 0xffffffffa002b000
    nf_conntrack_ipv4 9458 18 iptable_nat,nf_nat, Live 0xffffffffa0025000
    nf_defrag_ipv4 1062 1 nf_conntrack_ipv4, Live 0xffffffffa0021000
    xt_state 984 15 - Live 0xffffffffa001d000
    nf_conntrack 46767 5 xt_conntrack,iptable_nat,nf_nat,nf_conntrack_ipv4,xt_state, Live 0xffffffffa000c000
    vmxnet3 32175 0 - Live 0xffffffffa0000000
    iptables -V
    iptables v1.4.13
    uname -a
    Linux A-00AA 3.3.7 #7 SMP Sat Jul 28 20:52:14 PDT 2012 x86_64 GNU/Linux

    WARNING: this test will manipulate iptables rules.
    Don't do this on a production machine.
    Would you like to continue? y/n y
    test_table6 (iptc.test.test_iptc.TestTable6) ... ERROR
    test_refresh (iptc.test.test_iptc.TestTable) ... ERROR
    test_table (iptc.test.test_iptc.TestTable) ... ok
    test_builtin_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain_counters (iptc.test.test_iptc.TestChain) ... ok
    test_chain_policy (iptc.test.test_iptc.TestChain) ... ok
    test_chains (iptc.test.test_iptc.TestChain) ... ok
    test_create_chain (iptc.test.test_iptc.TestChain) ... ok
    test_is_chain (iptc.test.test_iptc.TestChain) ... ok
    test_rule_address (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule6) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule6) ... ERROR
    test_rule_address (iptc.test.test_iptc.TestRule) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule) ... ok
    test_rule_fragment (iptc.test.test_iptc.TestRule) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule) ... ERROR

    ERROR: test_table6 (iptc.test.test_iptc.TestTable6)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 33, in test_table6
    raw = iptc.Table6("raw")
    File "/home/iptc/ip6tc.py", line 608, in init
    self.refresh()
    File "/home/iptc/ip4tc.py", line 1310, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: Table does not exist (do you need to insmod?)

    ERROR: test_refresh (iptc.test.test_iptc.TestTable)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 90, in test_refresh
    match = iptc.Match(rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_rule_iterate (iptc.test.test_iptc.TestRule6)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 446, in test_rule_iterate
    for r in (rule for chain in iptc.Table6(iptc.Table6.RAW).chains
    File "/home/iptc/ip6tc.py", line 608, in init
    self.refresh()
    File "/home/iptc/ip4tc.py", line 1310, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: Table does not exist (do you need to insmod?)

    ERROR: test_rule_standard_target (iptc.test.test_iptc.TestRule6)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 424, in test_rule_standard_target
    target = iptc.Target(rule, "RETURN")
    File "/home/iptc/ip4tc.py", line 512, in init
    for t in rule.tables:
    File "/home/iptc/ip6tc.py", line 265, in _get_tables
    return [Table6(t) for t in Table6.ALL if is_table_available(t)]
    File "/home/iptc/ip6tc.py", line 608, in init
    self.refresh()
    File "/home/iptc/ip4tc.py", line 1310, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: Table does not exist (do you need to insmod?)

    ERROR: test_rule_iterate (iptc.test.test_iptc.TestRule)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 599, in test_rule_iterate
    for r in (rule for chain in iptc.Table(iptc.Table.FILTER).chains
    File "/home/iptc/test/test_iptc.py", line 600, in
    for rule in chain.rules if rule):
    File "/home/iptc/ip4tc.py", line 1204, in _get_rules
    return [Rule(e, self) for e in entries]
    File "/home/iptc/ip4tc.py", line 689, in init
    self.rule = entry
    File "/home/iptc/ip4tc.py", line 1067, in _set_rule
    self.target = Target(self, target=target)
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target

    ERROR: test_rule_standard_target (iptc.test.test_iptc.TestRule)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 581, in test_rule_standard_target
    target = iptc.Target(rule, "RETURN")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target RETURN


    Ran 23 tests in 0.058s

    FAILED (errors=6)
    test_match_compare (iptc.test.test_matches.TestMatch) ... ERROR
    test_match_create (iptc.test.test_matches.TestMatch) ... ERROR
    test_match_parameters (iptc.test.test_matches.TestMatch) ... ERROR
    test_udp_insert (iptc.test.test_matches.TestXTUdpMatch) ... ERROR
    test_udp_port (iptc.test.test_matches.TestXTUdpMatch) ... ERROR
    test_mark (iptc.test.test_matches.TestXTMarkMatch) ... ERROR
    test_mark_insert (iptc.test.test_matches.TestXTMarkMatch) ... ERROR
    test_limit (iptc.test.test_matches.TestXTLimitMatch) ... ERROR
    test_limit_insert (iptc.test.test_matches.TestXTLimitMatch) ... ERROR
    test_comment (iptc.test.test_matches.TestCommentMatch) ... ERROR
    test_iprange (iptc.test.test_matches.TestIprangeMatch) ... ERROR
    test_iprange_tcpdport (iptc.test.test_matches.TestIprangeMatch) ... ERROR

    ERROR: test_match_compare (iptc.test.test_matches.TestMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 32, in test_match_compare
    m1 = iptc.Match(iptc.Rule(), "udp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match udp

    ERROR: test_match_create (iptc.test.test_matches.TestMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 16, in test_match_create
    match = rule.create_match("udp")
    File "/home/iptc/ip4tc.py", line 719, in create_match
    match = Match(self, name=name, revision=revision)
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match udp

    ERROR: test_match_parameters (iptc.test.test_matches.TestMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 48, in test_match_parameters
    m = iptc.Match(iptc.Rule(), "udp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match udp

    ERROR: test_udp_insert (iptc.test.test_matches.TestXTUdpMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 69, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_udp_port (iptc.test.test_matches.TestXTUdpMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 69, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_mark (iptc.test.test_matches.TestXTMarkMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 120, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_mark_insert (iptc.test.test_matches.TestXTMarkMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 120, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_limit (iptc.test.test_matches.TestXTLimitMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 163, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_limit_insert (iptc.test.test_matches.TestXTLimitMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 163, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_comment (iptc.test.test_matches.TestCommentMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 205, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_iprange (iptc.test.test_matches.TestIprangeMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 228, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_iprange_tcpdport (iptc.test.test_matches.TestIprangeMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 228, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT


    Ran 12 tests in 0.009s

    FAILED (errors=12)
    test_target_compare (iptc.test.test_targets.TestTarget) ... ERROR
    test_target_create (iptc.test.test_targets.TestTarget) ... ERROR
    test_target_parameters (iptc.test.test_targets.TestTarget) ... ERROR
    test_insert (iptc.test.test_targets.TestXTClusteripTarget) ... ERROR
    test_mode (iptc.test.test_targets.TestXTClusteripTarget) ... ERROR
    test_insert (iptc.test.test_targets.TestIPTRedirectTarget) ... ERROR
    test_mode (iptc.test.test_targets.TestIPTRedirectTarget) ... ERROR
    test_insert (iptc.test.test_targets.TestXTTosTarget) ... ERROR
    test_mode (iptc.test.test_targets.TestXTTosTarget) ... ERROR
    test_insert (iptc.test.test_targets.TestIPTMasqueradeTarget) ... ERROR
    test_mode (iptc.test.test_targets.TestIPTMasqueradeTarget) ... ERROR

    ERROR: test_target_compare (iptc.test.test_targets.TestTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 31, in test_target_compare
    t1 = iptc.Target(iptc.Rule(), "MARK")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target MARK

    ERROR: test_target_create (iptc.test.test_targets.TestTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 19, in test_target_create
    target = rule.create_target("MARK")
    File "/home/iptc/ip4tc.py", line 727, in create_target
    target = Target(self, name=name, revision=revision)
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target MARK

    ERROR: test_target_parameters (iptc.test.test_targets.TestTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 44, in test_target_parameters
    t = iptc.Target(iptc.Rule(), "CONNMARK")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target CONNMARK

    ERROR: test_insert (iptc.test.test_targets.TestXTClusteripTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 70, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_mode (iptc.test.test_targets.TestXTClusteripTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 70, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_insert (iptc.test.test_targets.TestIPTRedirectTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 124, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_mode (iptc.test.test_targets.TestIPTRedirectTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 124, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_insert (iptc.test.test_targets.TestXTTosTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 173, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_mode (iptc.test.test_targets.TestXTTosTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 173, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_insert (iptc.test.test_targets.TestIPTMasqueradeTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 251, in setUp
    self.target = iptc.Target(self.rule, "MASQUERADE")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target MASQUERADE

    ERROR: test_mode (iptc.test.test_targets.TestIPTMasqueradeTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 251, in setUp
    self.target = iptc.Target(self.rule, "MASQUERADE")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target MASQUERADE


    Ran 11 tests in 0.007s

    FAILED (errors=11)

  4. ldx commented on Mar 3, 2013

    @ldx
    Owner

    Can you tell me the hash for the head you're using? I.e. output from git rev-parse HEAD (the test script in the current head at Github should only test the tables that are present on the system).

    At a first glance, it seems you're missing quite a few iptables modules. That's not really a problem as far as you don't intend to use them - do you leave them out from your kernel build deliberately?

  5. f34rdotcom commented on Mar 3, 2013

    @f34rdotcom
    Author

    Ya sorry I was using an old test.py and had feteched the content via a tgz not git.
    I got everything over again via git.

    git rev-parse HEAD
    ca689bf

    I then moved the iptc folder to my test box still using the original compiled wrapper C code.
    it did not look like you changed the wrapper in a long time so I did not bother to re cross compile it.

    To keep my disk size down to < 180 megs I do cut out a lot of fat so only the modules I need so everything can run with no physical disk everything runs out of a ramdisk for root.

    I did notice that all or most of my iptables modules are compiled into 2 single packages not sure when this changed in iptables probably recently.

    libip6tc.so
    libip4tc.so
    libiptc.so

    I noted that the code keeps looking for /usr/lib/xtables/libxt_standard.so

    This is probably normal for backwards compatibly but thought I should point it out as I think they are now all baked into the above modules.

    Re
    Sean M

    ====================== test script i run
    #!/usr/bin/env python

    -- coding: utf-8 --

    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(),
    test_targets.run_tests()]]
    for res in results:
    if res:
    sys.exit(1)

    =================== results
    WARNING: this test will manipulate iptables rules.
    Don't do this on a production machine.
    Would you like to continue? y/n y
    test_table6 (iptc.test.test_iptc.TestTable6) ... ERROR
    test_refresh (iptc.test.test_iptc.TestTable) ... ERROR
    test_table (iptc.test.test_iptc.TestTable) ... ok
    test_builtin_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain_counters (iptc.test.test_iptc.TestChain) ... ok
    test_chain_policy (iptc.test.test_iptc.TestChain) ... ok
    test_chains (iptc.test.test_iptc.TestChain) ... ok
    test_create_chain (iptc.test.test_iptc.TestChain) ... ok
    test_is_chain (iptc.test.test_iptc.TestChain) ... ok
    test_rule_address (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule6) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule6) ... ERROR
    test_rule_address (iptc.test.test_iptc.TestRule) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule) ... ok
    test_rule_fragment (iptc.test.test_iptc.TestRule) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule) ... ERROR

    ERROR: test_table6 (iptc.test.test_iptc.TestTable6)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 33, in test_table6
    raw = iptc.Table6("raw")
    File "/home/iptc/ip6tc.py", line 608, in init
    self.refresh()
    File "/home/iptc/ip4tc.py", line 1320, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: Table does not exist (do you need to insmod?)

    ERROR: test_refresh (iptc.test.test_iptc.TestTable)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 90, in test_refresh
    match = iptc.Match(rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_rule_iterate (iptc.test.test_iptc.TestRule6)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 446, in test_rule_iterate
    for r in (rule for chain in iptc.Table6(iptc.Table6.RAW).chains
    File "/home/iptc/ip6tc.py", line 608, in init
    self.refresh()
    File "/home/iptc/ip4tc.py", line 1320, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: Table does not exist (do you need to insmod?)

    ERROR: test_rule_standard_target (iptc.test.test_iptc.TestRule6)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 424, in test_rule_standard_target
    target = iptc.Target(rule, "RETURN")
    File "/home/iptc/ip4tc.py", line 512, in init
    for t in rule.tables:
    File "/home/iptc/ip6tc.py", line 265, in _get_tables
    return [Table6(t) for t in Table6.ALL if is_table_available(t)]
    File "/home/iptc/ip6tc.py", line 608, in init
    self.refresh()
    File "/home/iptc/ip4tc.py", line 1320, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: Table does not exist (do you need to insmod?)

    ERROR: test_rule_iterate (iptc.test.test_iptc.TestRule)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 599, in test_rule_iterate
    for r in (rule for chain in iptc.Table(iptc.Table.FILTER).chains
    File "/home/iptc/test/test_iptc.py", line 600, in
    for rule in chain.rules if rule):
    File "/home/iptc/ip4tc.py", line 1214, in _get_rules
    return [Rule(e, self) for e in entries]
    File "/home/iptc/ip4tc.py", line 689, in init
    self.rule = entry
    File "/home/iptc/ip4tc.py", line 1074, in _set_rule
    self.target = Target(self, target=target)
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target

    ERROR: test_rule_standard_target (iptc.test.test_iptc.TestRule)

    Traceback (most recent call last):
    File "/home/iptc/test/test_iptc.py", line 581, in test_rule_standard_target
    target = iptc.Target(rule, "RETURN")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target RETURN


    Ran 23 tests in 0.107s

    FAILED (errors=6)
    test_match_compare (iptc.test.test_matches.TestMatch) ... ERROR
    test_match_create (iptc.test.test_matches.TestMatch) ... ERROR
    test_match_parameters (iptc.test.test_matches.TestMatch) ... ERROR
    test_udp_insert (iptc.test.test_matches.TestXTUdpMatch) ... ERROR
    test_udp_port (iptc.test.test_matches.TestXTUdpMatch) ... ERROR
    test_mark (iptc.test.test_matches.TestXTMarkMatch) ... ERROR
    test_mark_insert (iptc.test.test_matches.TestXTMarkMatch) ... ERROR
    test_limit (iptc.test.test_matches.TestXTLimitMatch) ... ERROR
    test_limit_insert (iptc.test.test_matches.TestXTLimitMatch) ... ERROR
    test_comment (iptc.test.test_matches.TestCommentMatch) ... ERROR
    test_iprange (iptc.test.test_matches.TestIprangeMatch) ... ERROR
    test_iprange_tcpdport (iptc.test.test_matches.TestIprangeMatch) ... ERROR

    ERROR: test_match_compare (iptc.test.test_matches.TestMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 32, in test_match_compare
    m1 = iptc.Match(iptc.Rule(), "udp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match udp

    ERROR: test_match_create (iptc.test.test_matches.TestMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 16, in test_match_create
    match = rule.create_match("udp")
    File "/home/iptc/ip4tc.py", line 726, in create_match
    match = Match(self, name=name, revision=revision)
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match udp

    ERROR: test_match_parameters (iptc.test.test_matches.TestMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 48, in test_match_parameters
    m = iptc.Match(iptc.Rule(), "udp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match udp

    ERROR: test_udp_insert (iptc.test.test_matches.TestXTUdpMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 69, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_udp_port (iptc.test.test_matches.TestXTUdpMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 69, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_mark (iptc.test.test_matches.TestXTMarkMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 120, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_mark_insert (iptc.test.test_matches.TestXTMarkMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 120, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_limit (iptc.test.test_matches.TestXTLimitMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 163, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_limit_insert (iptc.test.test_matches.TestXTLimitMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 163, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_comment (iptc.test.test_matches.TestCommentMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 205, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_iprange (iptc.test.test_matches.TestIprangeMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 228, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_iprange_tcpdport (iptc.test.test_matches.TestIprangeMatch)

    Traceback (most recent call last):
    File "/home/iptc/test/test_matches.py", line 228, in setUp
    self.rule.target = iptc.Target(self.rule, "ACCEPT")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT


    Ran 12 tests in 0.022s

    FAILED (errors=12)
    test_target_compare (iptc.test.test_targets.TestTarget) ... ERROR
    test_target_create (iptc.test.test_targets.TestTarget) ... ERROR
    test_target_parameters (iptc.test.test_targets.TestTarget) ... ERROR
    test_insert (iptc.test.test_targets.TestXTClusteripTarget) ... ERROR
    test_mode (iptc.test.test_targets.TestXTClusteripTarget) ... ERROR
    test_insert (iptc.test.test_targets.TestIPTRedirectTarget) ... ERROR
    test_mode (iptc.test.test_targets.TestIPTRedirectTarget) ... ERROR
    test_insert (iptc.test.test_targets.TestXTTosTarget) ... ERROR
    test_mode (iptc.test.test_targets.TestXTTosTarget) ... ERROR
    test_insert (iptc.test.test_targets.TestIPTMasqueradeTarget) ... ERROR
    test_mode (iptc.test.test_targets.TestIPTMasqueradeTarget) ... ERROR

    ERROR: test_target_compare (iptc.test.test_targets.TestTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 31, in test_target_compare
    t1 = iptc.Target(iptc.Rule(), "MARK")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target MARK

    ERROR: test_target_create (iptc.test.test_targets.TestTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 19, in test_target_create
    target = rule.create_target("MARK")
    File "/home/iptc/ip4tc.py", line 734, in create_target
    target = Target(self, name=name, revision=revision)
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target MARK

    ERROR: test_target_parameters (iptc.test.test_targets.TestTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 44, in test_target_parameters
    t = iptc.Target(iptc.Rule(), "CONNMARK")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target CONNMARK

    ERROR: test_insert (iptc.test.test_targets.TestXTClusteripTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 70, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_mode (iptc.test.test_targets.TestXTClusteripTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 70, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_insert (iptc.test.test_targets.TestIPTRedirectTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 124, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_mode (iptc.test.test_targets.TestIPTRedirectTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 124, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_insert (iptc.test.test_targets.TestXTTosTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 173, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_mode (iptc.test.test_targets.TestXTTosTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 173, in setUp
    self.match = iptc.Match(self.rule, "tcp")
    File "/home/iptc/ip4tc.py", line 396, in init
    raise XTablesError("can't find match %s" % (name))
    XTablesError: can't find match tcp

    ERROR: test_insert (iptc.test.test_targets.TestIPTMasqueradeTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 251, in setUp
    self.target = iptc.Target(self.rule, "MASQUERADE")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target MASQUERADE

    ERROR: test_mode (iptc.test.test_targets.TestIPTMasqueradeTarget)

    Traceback (most recent call last):
    File "/home/iptc/test/test_targets.py", line 251, in setUp
    self.target = iptc.Target(self.rule, "MASQUERADE")
    File "/home/iptc/ip4tc.py", line 520, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target MASQUERADE


    Ran 11 tests in 0.017s

    FAILED (errors=11)

  6. f34rdotcom commented on Mar 4, 2013

    @f34rdotcom
    Author

    I have been looking over my kernel config I have been maintaining over the years and noted that I do a mix of baked in modules and loadable modules. I dont have x_tables.ko etc they are built in. I am wondering of that is causing some problems. I am going to test that this week and rebuild the kernel and modules to see it makes any difference. Maybe when they are baked its causing some problems.

    Re
    Sean M

  7. f34rdotcom commented on Mar 4, 2013

    @f34rdotcom
    Author

    Ok that did not help. Here is what my modules look like now. Looks more like what I would see on my own personal workstation and the exact same problem cant iterate

    failed tests are
    test_rule_standard_target
    test_refresh
    test_rule_iterate

    ip6table_mangle 1304 0 - Live 0xffffffffa0081000
    ip6table_filter 1048 0 - Live 0xffffffffa007d000
    ip6_tables 16260 2 ip6table_mangle,ip6table_filter, Live 0xffffffffa0076000
    ipt_LOG 6632 10 - Live 0xffffffffa0071000
    xt_helper 1112 0 - Live 0xffffffffa006d000
    xt_tcpudp 2168 11 - Live 0xffffffffa0069000
    iptable_raw 1048 0 - Live 0xffffffffa0065000
    xt_mark 952 0 - Live 0xffffffffa0061000
    xt_comment 760 0 - Live 0xffffffffa005d000
    ipt_REJECT 2040 4 - Live 0xffffffffa0059000
    xt_iprange 1368 0 - Live 0xffffffffa0055000
    xt_multiport 1496 4 - Live 0xffffffffa0051000
    xt_conntrack 2648 0 - Live 0xffffffffa004d000
    xt_state 984 14 - Live 0xffffffffa0049000
    iptable_mangle 1304 1 - Live 0xffffffffa0045000
    iptable_nat 3309 1 - Live 0xffffffffa0041000
    nf_nat 12812 1 iptable_nat, Live 0xffffffffa003a000
    nf_conntrack_ipv4 9458 17 iptable_nat,nf_nat, Live 0xffffffffa0034000
    nf_defrag_ipv4 1062 1 nf_conntrack_ipv4, Live 0xffffffffa0030000
    iptable_filter 1112 1 - Live 0xffffffffa002c000
    ip_tables 14757 4 iptable_raw,iptable_mangle,iptable_nat,iptable_filter, Live 0xffffffffa0025000
    x_tables 14949 18 ip6table_mangle,ip6table_filter,ip6_tables,ipt_LOG,xt_helper,xt_tcpudp,iptable_raw,xt_mark,xt_comment,ipt_REJECT,xt_iprange,xt_multiport,xt_conntrack,xt_state,iptable_mangle,iptable_nat,iptable_filter,ip_tables, Live 0xffffffffa001d000
    nf_conntrack 46767 6 xt_helper,xt_conntrack,xt_state,iptable_nat,nf_nat,nf_conntrack_ipv4, Live 0xffffffffa000c000
    vmxnet3 32175 0 - Live 0xffffffffa0000000

    Re
    Sean M

  8. ldx commented on Mar 4, 2013

    @ldx
    Owner
    1. Can you show the output of ls -1 /lib/xtables/?
    2. Any chance you can build a downloadable image from this system I could test in a VM? Thanks!
  9. f34rdotcom commented on Mar 4, 2013

    @f34rdotcom
    Author

    Sure can. My Mondays get a little crazy but I should be able to get it running in vmware workstation and avail for download by tonight. It will be about 128megs so should be easy to download.

    buildroot that I use to build everything does not produce files such as /lib/xtables/libxt_comment.so

    the iptables compile only builds the following shared libs: libip4tc.so libiptc.so libxtables.so

    looking over the build environment it seems as if it is building a static version of everything bundling all the xtables shared libs into a set of compact shared libs but I have not confirmed that this is normal yet.

    I can say that shorewall and iptables commands all seem to work fine.

    You have a donation url?

    Re
    Sean M

  10. ldx commented on Mar 4, 2013

    @ldx
    Owner

    Okay, waiting for the downloadable image.

    Indeed, if you compile iptables statically, then you'll only get the mentioned shared libs. If you'd like to donate you can use nilvec@nilvec.com with paypal.

  11. ldx commented on Mar 5, 2013

    @ldx
    Owner

    Just checking out the VM image it seems that indeed it's using static iptables libraries. I'll set up a similar environment and find the root cause for the failing tests.

  12. ldx commented on Apr 6, 2013

    @ldx
    Owner

    After some research it seems it's not really possible to load iptables extensions if iptables is compiled statically. In this case all the extensions applicable for the protocol family gets linked into the iptables/ip6tables executable - which we can't load dynamically.

    Can you recompile iptables for your platform with shared libraries?

  13. f34rdotcom commented on Apr 9, 2013

    @f34rdotcom
    Author

    I was able to build my iptables dynamic with some changes to the buildroot mk file for iptables. Now it looks a bit better but have a new error "ValueError: invalid value FIN,SYN,RST,ACK SYN" also I see "IPTCError: can't initialize raw: libiptc version error"

    I am not worried about the ipv6 errors.

    test_table6 (iptc.test.test_iptc.TestTable6) ... ERROR
    test_refresh (iptc.test.test_iptc.TestTable) ... ok
    test_table (iptc.test.test_iptc.TestTable) ... ok
    test_builtin_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain_counters (iptc.test.test_iptc.TestChain) ... ok
    test_chain_policy (iptc.test.test_iptc.TestChain) ... ok
    test_chains (iptc.test.test_iptc.TestChain) ... ok
    test_create_chain (iptc.test.test_iptc.TestChain) ... ok
    test_is_chain (iptc.test.test_iptc.TestChain) ... ok
    test_rule_address (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule6) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule6) ... ERROR
    test_rule_address (iptc.test.test_iptc.TestRule) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule) ... ok
    test_rule_fragment (iptc.test.test_iptc.TestRule) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule) ... ok

    ERROR: test_table6 (iptc.test.test_iptc.TestTable6)

    Traceback (most recent call last):
    File "/home/python-iptables/iptc/test/test_iptc.py", line 33, in test_table6
    raw = iptc.Table6("raw")
    File "/home/python-iptables/iptc/ip6tc.py", line 604, in init
    self.refresh()
    File "/home/python-iptables/iptc/ip4tc.py", line 1342, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: libiptc version error

    ERROR: test_rule_iterate (iptc.test.test_iptc.TestRule6)

    Traceback (most recent call last):
    File "/home/python-iptables/iptc/test/test_iptc.py", line 447, in test_rule_iterate
    for r in (rule for chain in iptc.Table6(iptc.Table6.RAW).chains
    File "/home/python-iptables/iptc/ip6tc.py", line 604, in init
    self.refresh()
    File "/home/python-iptables/iptc/ip4tc.py", line 1342, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: libiptc version error

    ERROR: test_rule_standard_target (iptc.test.test_iptc.TestRule6)

    Traceback (most recent call last):
    File "/home/python-iptables/iptc/test/test_iptc.py", line 425, in test_rule_standard_target
    target = iptc.Target(rule, "RETURN")
    File "/home/python-iptables/iptc/ip4tc.py", line 533, in init
    for t in rule.tables:
    File "/home/python-iptables/iptc/ip6tc.py", line 261, in _get_tables
    return [Table6(t) for t in Table6.ALL if is_table_available(t)]
    File "/home/python-iptables/iptc/ip6tc.py", line 604, in init
    self.refresh()
    File "/home/python-iptables/iptc/ip4tc.py", line 1342, in refresh
    self.strerror()))
    IPTCError: can't initialize raw: libiptc version error

    ERROR: test_rule_iterate (iptc.test.test_iptc.TestRule)

    Traceback (most recent call last):
    File "/home/python-iptables/iptc/test/test_iptc.py", line 633, in test_rule_iterate
    for r in (rule for chain in iptc.Table(iptc.Table.FILTER).chains
    File "/home/python-iptables/iptc/test/test_iptc.py", line 634, in
    for rule in chain.rules if rule):
    File "/home/python-iptables/iptc/ip4tc.py", line 1236, in _get_rules
    return [self.table.create_rule(e, self) for e in entries]
    File "/home/python-iptables/iptc/ip4tc.py", line 1525, in create_rule
    return Rule(entry, chain)
    File "/home/python-iptables/iptc/ip4tc.py", line 711, in init
    self.rule = entry
    File "/home/python-iptables/iptc/ip4tc.py", line 1090, in _set_rule
    m = Match(self, match=match)
    File "/home/python-iptables/iptc/ip4tc.py", line 428, in init
    self._update_parameters()
    File "/home/python-iptables/iptc/ip4tc.py", line 344, in update_parameters
    self.setattr(k, v)
    File "/home/python-iptables/iptc/ip4tc.py", line 348, in setattr
    self.parse(name.replace("
    ", "-"), value)
    File "/home/python-iptables/iptc/ip4tc.py", line 267, in parse
    self._parse(argv, inv, entry)
    File "/home/python-iptables/iptc/ip4tc.py", line 450, in _parse
    ct.cast(self._ptrptr, ct.POINTER(ct.c_void_p)))
    File "/home/python-iptables/iptc/xtables.py", line 735, in new
    ret = fn(*args)
    File "/home/python-iptables/iptc/xtables.py", line 1024, in parse_match
    self._parse(m, argv, invert, flags, fw, ptr)
    File "/home/python-iptables/iptc/xtables.py", line 931, in _parse
    raise ValueError("invalid value %s" % (argv[1]))
    ValueError: invalid value FIN,SYN,RST,ACK SYN


    Ran 23 tests in 0.079s

    FAILED (errors=4)
    test_match_compare (iptc.test.test_matches.TestMatch) ... ok
    test_match_create (iptc.test.test_matches.TestMatch) ... ok
    test_match_parameters (iptc.test.test_matches.TestMatch) ... ok
    test_udp_insert (iptc.test.test_matches.TestXTUdpMatch) ... ok
    test_udp_port (iptc.test.test_matches.TestXTUdpMatch) ... ok
    test_mark (iptc.test.test_matches.TestXTMarkMatch) ... ok
    test_mark_insert (iptc.test.test_matches.TestXTMarkMatch) ... ok
    test_limit (iptc.test.test_matches.TestXTLimitMatch) ... ok
    test_limit_insert (iptc.test.test_matches.TestXTLimitMatch) ... ok
    test_comment (iptc.test.test_matches.TestCommentMatch) ... ok
    test_iprange (iptc.test.test_matches.TestIprangeMatch) ... ok
    test_iprange_tcpdport (iptc.test.test_matches.TestIprangeMatch) ... ok


    Ran 12 tests in 0.082s

    OK
    test_target_compare (iptc.test.test_targets.TestTarget) ... ok
    test_target_create (iptc.test.test_targets.TestTarget) ... ok
    test_target_parameters (iptc.test.test_targets.TestTarget) ... ok
    test_insert (iptc.test.test_targets.TestXTClusteripTarget) ... ok
    test_mode (iptc.test.test_targets.TestXTClusteripTarget) ... ok
    test_insert (iptc.test.test_targets.TestIPTRedirectTarget) ... ok
    test_mode (iptc.test.test_targets.TestIPTRedirectTarget) ... ok
    test_insert (iptc.test.test_targets.TestXTTosTarget) ... ok
    test_mode (iptc.test.test_targets.TestXTTosTarget) ... ok
    test_insert (iptc.test.test_targets.TestIPTMasqueradeTarget) ... ok
    test_mode (iptc.test.test_targets.TestIPTMasqueradeTarget) ... ok


    Ran 11 tests in 0.019s

  14. ldx commented on Apr 12, 2013

    @ldx
    Owner

    Can you check if the current head ecb8d47 brings any improvements?

  15. f34rdotcom commented on Apr 12, 2013

    @f34rdotcom
    Author

    WARNING: this test will manipulate iptables rules.
    Don't do this on a production machine.
    Would you like to continue? y/n y
    test_table6 (iptc.test.test_iptc.TestTable6) ... ok
    test_table6_autocommit (iptc.test.test_iptc.TestTable6) ... ok
    test_refresh (iptc.test.test_iptc.TestTable) ... ok
    test_table (iptc.test.test_iptc.TestTable) ... ok
    test_builtin_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain (iptc.test.test_iptc.TestChain) ... ok
    test_chain_counters (iptc.test.test_iptc.TestChain) ... ok
    test_chain_policy (iptc.test.test_iptc.TestChain) ... ok
    test_chains (iptc.test.test_iptc.TestChain) ... ok
    test_create_chain (iptc.test.test_iptc.TestChain) ... ok
    test_is_chain (iptc.test.test_iptc.TestChain) ... ok
    test_rule_address (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule6) ... /usr/lib/xtables/libxt_standard.so: no "standard" extension found for this protocol
    /usr/lib/xtables/libxt_standard.so: no "standard" extension found for this protocol
    ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule6) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule6) ... /usr/lib/xtables/libxt_standard.so: no "standard" extension found for this protocol
    /usr/lib/xtables/libxt_standard.so: no "standard" extension found for this protocol
    ERROR
    test_rule_address (iptc.test.test_iptc.TestRule) ... ok
    test_rule_compare (iptc.test.test_iptc.TestRule) ... ok
    test_rule_fragment (iptc.test.test_iptc.TestRule) ... ok
    test_rule_interface (iptc.test.test_iptc.TestRule) ... ok
    test_rule_iterate (iptc.test.test_iptc.TestRule) ... ERROR
    test_rule_protocol (iptc.test.test_iptc.TestRule) ... ok
    test_rule_standard_target (iptc.test.test_iptc.TestRule) ... ok

    ERROR: test_rule_iterate (iptc.test.test_iptc.TestRule6)

    Traceback (most recent call last):
    File "/home/python-iptables/iptc/test/test_iptc.py", line 483, in test_rule_iterate
    target = iptc.Target(rule, "ACCEPT")
    File "/home/python-iptables/iptc/ip4tc.py", line 541, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target ACCEPT

    ERROR: test_rule_standard_target (iptc.test.test_iptc.TestRule6)

    Traceback (most recent call last):
    File "/home/python-iptables/iptc/test/test_iptc.py", line 443, in test_rule_standard_target
    target = iptc.Target(rule, "RETURN")
    File "/home/python-iptables/iptc/ip4tc.py", line 541, in init
    raise XTablesError("can't find target %s" % (name))
    XTablesError: can't find target RETURN

    ERROR: test_rule_iterate (iptc.test.test_iptc.TestRule)

    Traceback (most recent call last):
    File "/home/python-iptables/iptc/test/test_iptc.py", line 651, in test_rule_iterate
    for r in (rule for chain in iptc.Table(iptc.Table.FILTER).chains
    File "/home/python-iptables/iptc/test/test_iptc.py", line 652, in
    for rule in chain.rules if rule):
    File "/home/python-iptables/iptc/ip4tc.py", line 1236, in _get_rules
    return [self.table.create_rule(e, self) for e in entries]
    File "/home/python-iptables/iptc/ip4tc.py", line 1528, in create_rule
    return Rule(entry, chain)
    File "/home/python-iptables/iptc/ip4tc.py", line 711, in init
    self.rule = entry
    File "/home/python-iptables/iptc/ip4tc.py", line 1090, in _set_rule
    m = Match(self, match=match)
    File "/home/python-iptables/iptc/ip4tc.py", line 428, in init
    self._update_parameters()
    File "/home/python-iptables/iptc/ip4tc.py", line 344, in update_parameters
    self.setattr(k, v)
    File "/home/python-iptables/iptc/ip4tc.py", line 348, in setattr
    self.parse(name.replace("
    ", "-"), value)
    File "/home/python-iptables/iptc/ip4tc.py", line 267, in parse
    self._parse(argv, inv, entry)
    File "/home/python-iptables/iptc/ip4tc.py", line 450, in _parse
    ct.cast(self._ptrptr, ct.POINTER(ct.c_void_p)))
    File "/home/python-iptables/iptc/xtables.py", line 735, in new
    ret = fn(*args)
    File "/home/python-iptables/iptc/xtables.py", line 1024, in parse_match
    self._parse(m, argv, invert, flags, fw, ptr)
    File "/home/python-iptables/iptc/xtables.py", line 931, in _parse
    raise ValueError("invalid value %s" % (argv[1]))
    ValueError: invalid value FIN,SYN,RST,ACK SYN


    Ran 24 tests in 0.078s

    FAILED (errors=3)
    test_match_compare (iptc.test.test_matches.TestMatch) ... ok
    test_match_create (iptc.test.test_matches.TestMatch) ... ok
    test_match_parameters (iptc.test.test_matches.TestMatch) ... ok
    test_udp_insert (iptc.test.test_matches.TestXTUdpMatch) ... ok
    test_udp_port (iptc.test.test_matches.TestXTUdpMatch) ... ok
    test_mark (iptc.test.test_matches.TestXTMarkMatch) ... ok
    test_mark_insert (iptc.test.test_matches.TestXTMarkMatch) ... ok
    test_limit (iptc.test.test_matches.TestXTLimitMatch) ... ok
    test_limit_insert (iptc.test.test_matches.TestXTLimitMatch) ... ok
    test_comment (iptc.test.test_matches.TestCommentMatch) ... ok
    test_iprange (iptc.test.test_matches.TestIprangeMatch) ... ok
    test_iprange_tcpdport (iptc.test.test_matches.TestIprangeMatch) ... ok


    Ran 12 tests in 0.082s

    OK
    test_target_compare (iptc.test.test_targets.TestTarget) ... ok
    test_target_create (iptc.test.test_targets.TestTarget) ... ok
    test_target_parameters (iptc.test.test_targets.TestTarget) ... ok
    test_insert (iptc.test.test_targets.TestXTClusteripTarget) ... ok
    test_mode (iptc.test.test_targets.TestXTClusteripTarget) ... ok
    test_insert (iptc.test.test_targets.TestIPTRedirectTarget) ... ok
    test_mode (iptc.test.test_targets.TestIPTRedirectTarget) ... ok
    test_insert (iptc.test.test_targets.TestXTTosTarget) ... ok
    test_mode (iptc.test.test_targets.TestXTTosTarget) ... ok
    test_insert (iptc.test.test_targets.TestIPTMasqueradeTarget) ... ok
    test_mode (iptc.test.test_targets.TestIPTMasqueradeTarget) ... ok


    Ran 11 tests in 0.018s

    OK

  16. ldx commented on Apr 13, 2013

    @ldx
    Owner

    As for the test_rule_iterate() failure, can you try to pull and run the tests again? That one I fixed a few hours ago.

    I've got the other two test failures as well, it just needs a few more lines to be changed - will fix it soon.

  17. ldx commented on Apr 13, 2013

    @ldx
    Owner

    Just pushed a fix - let me know if it works for you now.

  18. ldx commented on Jun 22, 2013

    @ldx
    Owner

    This should be fixed - please reopen if you still have problems.

  19. added a commit that references this issue on May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions