]> git.puffer.fish Git - matthieu/frr.git/commit
zebra: fix config after exit from vrf
authorIgor Ryzhov <iryzhov@nfware.com>
Wed, 2 Jun 2021 14:27:02 +0000 (17:27 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Fri, 4 Jun 2021 16:02:32 +0000 (19:02 +0300)
commit58929633fb1073e0010bca34688ff0c6be15909e
tree497ae0f26a0ec84ec2337f14fa30f08fadbf503e
parentdd553fb39b02cd4391d50ffb84b45da7248906ed
zebra: fix config after exit from vrf

When the VRF node is exited using "exit" or "quit", there's still a VRF
pointer stored in the vty context. If you try to configure some router
related command, it will be applied to the previous VRF instead of the
default VRF. For example:

```
(config)# vrf test
(config-vrf)# ip router-id 1.1.1.1
(config-vrf)# do show run
...
!
vrf test
 ip router-id 1.1.1.1
 exit-vrf
!
...
(config-vrf)# exit
(config)# ip router-id 2.2.2.2
(config)# do show run
...
!
vrf test
 ip router-id 2.2.2.2
 exit-vrf
!
...
```

`vrf-exit` works correctly, because it stores a pointer to the default
VRF into the vty context (but weirdly keeping the VRF_NODE instead of
changing it to CONFIG_NODE).

Instead of relying on the behavior of exit function, always use the
default VRF when in CONFIG_NODE.

Another problem is missing `VTY_CHECK_CONTEXT`. If someone deletes the
VRF in which node the user enters the command, then zebra applies the
command to the default VRF instead of throwing an error.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
lib/vrf.c
zebra/zebra_vrf.h