Skip to content

Commit

Permalink
T6221: Return default ip rule values after deleting VRF
Browse files Browse the repository at this point in the history
Fix for restoring default ip rule values after deleting VRF

Defult values:
```
$ ip rule
0:	from all lookup local
32766:	from all lookup main
32767:	from all lookup default
```

After adding and deleting a VRF we get unexpected values:
```
$ ip rule
1000:	from all lookup [l3mdev-table]
2000:	from all lookup [l3mdev-table] unreachable
32765:	from all lookup local
32766:	from all lookup main
32767:	from all lookup default
```
  • Loading branch information
sever-sever committed Apr 18, 2024
1 parent 24c997d commit ce0bc35
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/conf_mode/vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,20 @@ def apply(vrf):
for chain, rule in nftables_rules.items():
cmd(f'nft flush chain inet vrf_zones {chain}')

# Return default ip rule values
if 'name' not in vrf:
for afi in ['-4', '-6']:
# move lookup local to pref 0 (from 32765)
if not has_rule(afi, 0, 'local'):
call(f'ip {afi} rule add pref 0 from all lookup local')
if has_rule(afi, 32765, 'local'):
call(f'ip {afi} rule del pref 32765 table local')

if has_rule(afi, 1000, 'l3mdev'):
call(f'ip {afi} rule del pref 1000 l3mdev protocol kernel')
if has_rule(afi, 2000, 'l3mdev'):
call(f'ip {afi} rule del pref 2000 l3mdev unreachable')

# Apply FRR filters
zebra_daemon = 'zebra'
# Save original configuration prior to starting any commit actions
Expand Down

0 comments on commit ce0bc35

Please sign in to comment.