-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error while running the example #9
Comments
Can you paste the actual code? |
import iptc
chain = iptc.Chain(iptc.TABLE_NAT, "POSTROUTING")
rule = iptc.Rule()
rule.protocol = "tcp"
rule.out_interface = "eth0"
target = iptc.Target(rule, "MASQUERADE")
target.to_ports = "1234"
rule.target = target
chain.insert_rule(rule) i got the code from http://nilvec.com/stuff/python-iptables/docs/html/examples.html#simple-rule-not-using-any-match-extensions |
Can you tell me the version of your OS and iptables? Do you use the latest python-iptables from github? |
Ubuntu 12.04 iptables v1.4.12. yes i cloned the code from here and ran setup.py |
Some of the core structures in iptables have changed. Let me take some time to figure out how python-iptables can use them without breaking compatibility with older versions. |
I have this issue too, any ETA on when it's going to be fixed ? Thanks. |
Hi, Thanks for putting this library out there! |
See #13 for a patch (not fully functional, needs some more work it seems). |
Hi, I'm very new with git and github, can you please explain me how to get the patch for this issue ? Thanks. |
Ok, I cloned hach-que/python-iptables and tried to build it but I think it is missing a file: [mageia@dci-laptop hach-que-python-iptables (master)]$ python setup.py build running build_ext |
Yes, modify that line to "#include <xtables.h>", and make sure the iptables-dev package (on Ubuntu) is installed. |
Ok I'm not sure what you mean with "modify that line to "#include"", but I changed that include to "#include "xtables.h" and now the error changed to this: gcc -pthread -shared -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags build/temp.linux-x86_64-2.7/libxtwrapper/wrapper.o -L/usr/lib64 -lpython2.7 -o build/lib.linux-x86_64-2.7/libxtwrapper.so -g -O0 I'm on Mageia 2 with iptables-devel-1.4.12.2-2 installed. btw, I maintain python-iptables for Mageia and I'm also have a package for OpenSUSE that I want to get included. |
If you have python-iptables already installed, first remove it. You should also use '#include <xtables.h>', not '#include "xtables.h"'. Let me know if this helps - for me it compiles with iptables v1.4.12. |
Yes, I had python-iptables removed, I really don't understand what you mean with the include statement, of course if I leave only: #include compilation will fail as it is an incomplete #include statement. |
Sorry, it should be |
On Mon, Oct 15, 2012 at 3:34 AM, ldx notifications@github.com wrote:
|
Ok, the problem was a missing linker flag to link against libxtables. I created a pull request to merge this fix and the previous one about the wrong include for xtables.h on libxtwrapper/wrapper.c: |
Ok, I tested again with the hach-que/python-iptables fork and this issue is still present: chain = iptc.Chain(iptc.TABLE_FILTER, "INPUT")
rule = iptc.Rule()
rule.protocol = "tcp"
rule.in_interface = "eth+"
rule.src = "10.0.2.2"
rule.dst = "10.1.1.1"
target = iptc.Target(rule, "DROP")
target.to_ports = str(666)
rule.target = target
chain.insert_rule(rule) Produces the same error:
|
See the other tickets, iptables 1.4 introduced new module callbacks - we're not compatible with it yet. |
Please take a look at HEAD, and open a new ticket if you still experience issues. The new iptables API is now supported by python-iptables (see http://nilvec.com/python-iptables-update/ for further info). |
Resolving minor typos when doing e2e test on Pi 3
hi i am getting this error while running AttributeError: MASQUERADE: invalid parameter to-ports. I am using the Simple Rule not using any match extension example
The text was updated successfully, but these errors were encountered: