Skip to content

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

Open
@hetii

Description

@hetii

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions