-
Notifications
You must be signed in to change notification settings - Fork 183
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
Bug - target.to_destination need to be inoked otherise issue happen in iptc/ip4tc.py #241
Comments
Did you install python-iptables via pip? Can you check what version it is? |
I install it always by pipenv in latest version, no clue now on with version it was when I put this issue here... :/ |
Hey everyone, I have the same error when creating a nat rule using target.to_destination for the prerouting chain
python-iptables version: 0.13.0 |
So I just looked at it a bit more. After multiple attempts to debug it. I started to a see a clue. I saw bits and pieces of my stdout in the python-iptables variable x (line 423, ip4tc.py). My parent program, which called on python-itpables, was writing to stdout. I had hundreds of print statement, and other stdout related activity. I ran my parent program with unbuffered print, and now python-iptables now magically works. I noticed in ip4tc.py that function __get_saved_buf reads from stdout. So I am not wrong at all. Something is getting overwritten. Can someone else confirm this? Thanks Update Still having the issue. stdout is being pushed into variables in ip4tc.py. Unbuffered print didn't do anything. Though it is much less common now. |
@hheennrryy21 I couldn't reproduce your issue on my test installation from my ipython3 interpreter. OS: Debian GNU/Linux 9.9 (stretch) If I may ask, in your script you first disable autocommit on the table, then without doing any alterations to the table/chain, you then refresh(), commit() and enable autocommit again, before attempting to insert your rule, why is that? On another note, there is a new module added in master, iptc.easy that would allow you to do something like this:
|
Hi jllorente, There is no reason why I had autocommit=False in the beginning. I was assuming this was the default when the iptc.Table object gets created. I wanted to let the team know that I've still been seeing this stdout issue for some time now since this ticket was created. Occasionally, when my program runs I am able to cause iptc to interpret an stdout message from my program as a valid entry. When I get a chance I will build a script that will replicate this problem. I am using python2.7, so I don't know what kind of issue that can cause. I may be looking at two different errors. I will be a bit more descriptive when I come back to this. |
Hi.
I use such prerouting method to set my rule.
There is odd issue that happens in iptc/ip4tc.py when I don`t
invoke target.to_destination by print() or type(), whatever.
Otherwise in function get_all_parameters() of iptc/ip4tc.py res.pop() return None and
that`s why required key is undefined.
This issue happen just on my centos system.
The text was updated successfully, but these errors were encountered: