Skip to content

Fedora 16/17: error while running example #14

Closed

Description

@cioban

Hi,

When I tried to run this example on Fedora 16 or 17:

import iptc
chain = iptc.Chain(iptc.TABLE_MANGLE, "PREROUTING")
rule = iptc.Rule()
rule.dst = "192.168.1.2"
rule.protocol = "udp"
match = iptc.Match(rule, "udp")
match.dport = "1234"
rule.add_match(match)
target = iptc.Target(rule, "MARK", revision=2) # latest revision
target.set_mark = "0xffff"
rule.target = target
chain.insert_rule(rule)

I got this error:
Traceback (most recent call last):
File "./teste.py", line 40, in
match.dport = "1234"
File "/usr/lib64/python2.7/site-packages/iptc/init.py", line 360, in setattr
self.parse(name.replace("_", "-"), value)
File "/usr/lib64/python2.7/site-packages/iptc/init.py", line 305, in parse
(self._module.name, parameter))
AttributeError: udp: invalid parameter dport

My software:
Kernel: 3.4.2-1.fc16.x86_64 SMP Thu Jun 14 20:17:26 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
iptables: v1.4.12
python-iptables: from github

What can I do to solve this?

Thanks

Activity

  1. ldx commented on Sep 20, 2012

    @ldx
    Owner

    See #13 for a proposed patch. It doesn't work yet, however - core structures in iptables have changed in version 1.4.

  2. ldx commented on Jan 25, 2013

    @ldx
    Owner

    Please take a look at HEAD - python-iptables should now work with the new iptables API.

  3. cioban commented on Jan 25, 2013

    @cioban
    Author

    Ok, thanks...

    Sergio Cioban Filho
    Especialista em redes e segurança de sistemas - PUCPR
    Linux Professional Institute Certified - Level 2
    Novell Certified Linux Administrator
    D-Link Adavanced Certification - Switch

    Tecnólogo em Gestão de TI

    Consultoria e projetos em soluções OpenSource

    | linux :: network :: virtualization :: clustering :: development
    | cioban@gmail.com - http://cioban.cc
    | +55 48 9989-8733

    | twitter: @cioban

    On Fri, Jan 25, 2013 at 3:44 PM, ldx notifications@github.com wrote:

    Please take a look at HEAD - python-iptables should now work with the new
    iptables API.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-12712049.

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