]> git.puffer.fish Git - matthieu/frr.git/commit
lib: fix nb callbacks for containers inside choice case
authorIgor Ryzhov <iryzhov@nfware.com>
Fri, 23 Feb 2024 22:06:41 +0000 (00:06 +0200)
committerIgor Ryzhov <iryzhov@nfware.com>
Fri, 23 Feb 2024 23:39:18 +0000 (01:39 +0200)
commit0b905f740459291bca12e552aea4975fb46e9d98
treec557d44049cd49936d6f53d7d700a609b6b8348f
parent38b85e0c2bc555b8827dbd2cb6515b6febf548b4
lib: fix nb callbacks for containers inside choice case

Containers inside a choice's case must be treated as presence containers
as they can be explicitly created and deleted. They must have `create`
and `destroy` callbacks, otherwise the internal data they represent may
never be deleted.

The issue can be reproduced with the following steps:
- create an access-list with destination-network params
  ```
  # access-list test seq 1 permit ip any 10.10.10.0 0.0.0.255
  ```
- delete the `destination-network` container
  ```
  # mgmt delete-config /frr-filter:lib/access-list[name='test'][type='ipv4']/entry[sequence='1']/destination-network
  # mgmt commit apply
  MGMTD: No changes found to be committed!
  ```

As the `destination-network` container is non-presence, and all its
leafs are mandatory, mgmtd doesn't see any changes to be commited and
simply updates its YANG data tree without passing any updates to backend
daemons.

This commit fixes the issue by requiring `create` and `destroy`
callbacks for containers inside choice's cases.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
bgpd/bgp_routemap_nb.c
bgpd/bgp_routemap_nb.h
bgpd/bgp_routemap_nb_config.c
lib/filter_nb.c
lib/northbound.c
zebra/zebra_nb.c
zebra/zebra_nb.h
zebra/zebra_nb_config.c