summaryrefslogtreecommitdiff
path: root/src/conf_mode/policy-local-route.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-01-21 14:51:04 +0100
committerGitHub <noreply@github.com>2022-01-21 14:51:04 +0100
commitf791d3ef4c33a4175813f0c00c41ae20aaa447d0 (patch)
tree895a0e3adad8c39f873318e8bdca7642856ce8e3 /src/conf_mode/policy-local-route.py
parentec5eb00bd83a235492d3742bf3f80c604f5206dd (diff)
parent2e4bceee568d4f132d0667a3ca51d05154f375d5 (diff)
downloadvyos-1x-f791d3ef4c33a4175813f0c00c41ae20aaa447d0.tar.gz
vyos-1x-f791d3ef4c33a4175813f0c00c41ae20aaa447d0.zip
Merge pull request #1183 from hensur/current-ipv6-local-route
policy: T4151: Bugfix policy ipv6-local-route
Diffstat (limited to 'src/conf_mode/policy-local-route.py')
-rwxr-xr-xsrc/conf_mode/policy-local-route.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/conf_mode/policy-local-route.py b/src/conf_mode/policy-local-route.py
index 2541603e2..6dabb37ae 100755
--- a/src/conf_mode/policy-local-route.py
+++ b/src/conf_mode/policy-local-route.py
@@ -121,11 +121,14 @@ def apply(pbr):
if rule_rm in pbr:
v6 = " -6" if rule_rm == 'rule6_remove' else ""
for rule, rule_config in pbr[rule_rm].items():
- for src in (rule_config['source'] or ['']):
+ rule_config['source'] = rule_config['source'] if 'source' in rule_config else ['']
+ for src in rule_config['source']:
f_src = '' if src == '' else f' from {src} '
- for dst in (rule_config['destination'] or ['']):
+ rule_config['destination'] = rule_config['destination'] if 'destination' in rule_config else ['']
+ for dst in rule_config['destination']:
f_dst = '' if dst == '' else f' to {dst} '
- for fwmk in (rule_config['fwmark'] or ['']):
+ rule_config['fwmark'] = rule_config['fwmark'] if 'fwmark' in rule_config else ['']
+ for fwmk in rule_config['fwmark']:
f_fwmk = '' if fwmk == '' else f' fwmark {fwmk} '
call(f'ip{v6} rule del prio {rule} {f_src}{f_dst}{f_fwmk}')
@@ -141,9 +144,11 @@ def apply(pbr):
for rule, rule_config in pbr_route['rule'].items():
table = rule_config['set']['table']
- for src in (rule_config['source'] or ['all']):
+ rule_config['source'] = rule_config['source'] if 'source' in rule_config else ['all']
+ for src in rule_config['source'] or ['all']:
f_src = '' if src == '' else f' from {src} '
- for dst in (rule_config['destination'] or ['all']):
+ rule_config['destination'] = rule_config['destination'] if 'destination' in rule_config else ['all']
+ for dst in rule_config['destination']:
f_dst = '' if dst == '' else f' to {dst} '
f_fwmk = ''
if 'fwmark' in rule_config: