]> git.proxmox.com Git - mirror_frr.git/commit
vrf: mark vrf as configured when entering vrf node
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 9 Feb 2021 18:38:45 +0000 (21:38 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 16 Feb 2021 18:05:15 +0000 (21:05 +0300)
commit2bdc59ca21da2d67b77ec70a2fadffbca60690cd
tree5f46c0704d4677814ca32a2a7d0e34f71d46ee74
parentb9611f65a71adc0b8fa14a5a4d1a8f44e04dcd85
vrf: mark vrf as configured when entering vrf node

The VRF must be marked as configured when user enters "vrf NAME" command.

Otherwise, the following problem occurs:

`ip link add red type vrf table 1`

  VRF structure is allocated.

`vtysh -c "conf t" -c "vrf red"`

  `lib_vrf_create` is called, and pointer to the VRF structure is stored
  to the nb_config_entry.

`ip link del red`

  VRF structure is freed (because it is not marked as configured), but
  the pointer is still stored in the nb_config_entry.

`vtysh -c "conf t" -c "no vrf red"`

  Nothing happens, because VRF structure doesn't exist. It means that
  `lib_vrf_destroy` is not called, and nb_config_entry still exists in
  the running config with incorrect pointer.

`ip link add red type vrf table 1`

  New VRF structure is allocated.

`vtysh -c "conf t" -c "vrf red"`

  `lib_vrf_create` is NOT called, because the nb_config_entry for that
  VRF name still exists in the running config.

After that all NB commands for this VRF will use incorrect pointer to
the freed VRF structure.

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