Commit 6e7f7d4b authored by Peter V. Saveliev's avatar Peter V. Saveliev

ipdb: fix `rules.add()` with a default action

Bug-Url: https://github.com/svinota/pyroute2/issues/331
parent a8993ecf
......@@ -245,8 +245,6 @@ class RulesDict(dict):
Create a rule from a dictionary
'''
spec = dict(spec or kwarg)
rule = Rule(self.ipdb)
rule.update(spec)
# action and priority are parts of the key, so
# they must be specified
if 'priority' not in spec:
......@@ -255,6 +253,9 @@ class RulesDict(dict):
spec['action'] = FR_ACT_NAMES['FR_ACT_TO_TBL']
elif 'goto' in spec:
spec['action'] = FR_ACT_NAMES['FR_ACT_GOTO']
rule = Rule(self.ipdb)
rule.update(spec)
# setup the scope
with rule._direct_state:
rule['ipdb_scope'] = 'create'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment