Skip to content
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

Rule not added to chain.rules when created by using iptc.Rule(chain=chain), bug? #245

Open
hetii opened this issue Aug 7, 2018 · 0 comments

Comments

@hetii
Copy link

hetii commented Aug 7, 2018

I notice that chain.rules have no rule that is created with iptc.Rule(chain=chain),
I know we can add a rule by: chain.insert_rule(rule) but its not like it should be there already?
If not why Rule() accept chain argument?

In [1]: import iptc
   ...: table = iptc.Table("nat")
   ...: chain = iptc.Chain(table, "PREROUTING")
   ...: rule  = iptc.Rule(chain=chain)
   ...: print(chain, rule.chain)
   ...: print(chain.rules, rule)

print_1:
<iptc.ip4tc.Chain object at 0x7f0cdb351390> <iptc.ip4tc.Chain object at 0x7f0cdb351390>

print_2:
[
 <iptc.ip4tc.Rule object at 0x7f0cdb351400>, 
 <iptc.ip4tc.Rule object at 0x7f0cd86d3550>, 
 <iptc.ip4tc.Rule object at 0x7f0cd86d3710>, 
 <iptc.ip4tc.Rule object at 0x7f0cd86d3860>
] 

 <iptc.ip4tc.Rule object at 0x7f0cdb351668>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant