Skip to content

--random parameter not working with SNAT #339

Description

@tom130380

There seems to be an issue storing the --random parameter in the list of parameters of an SNAT target:

import iptc
table = iptc.Table("nat")
rule = iptc.Rule()
target = rule.create_target("SNAT")
target.random = ""
target.to_source = "10.10.101.254"
target.get_all_parameters()
{'to-source': ['10.10.101.254']}
iptc.easy.decode_iptc_rule(rule)
{'target': {'SNAT': {'to-source': '10.10.101.254'}}, 'counters': (0, 0)}

or via encoding a rule by using a dict and then decoding it again:

rule_dict = {'src': '10.10.121.254/32', 'target': {'SNAT': {'to-source': '10.10.101.254', 'random': ''}}, 'counters': (0, 0)}
rule = iptc.easy.encode_iptc_rule(rule_dict)
iptc.easy.decode_iptc_rule(rule)
{'src': '10.10.121.254/32', 'target': {'SNAT': {'to-source': '10.10.101.254'}}, 'counters': (0, 0)}

Am I missing something or is this indeed a bug?

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions