]> git.puffer.fish Git - mirror/frr.git/commit
lib: fix order of northbound operations
authorIgor Ryzhov <iryzhov@nfware.com>
Fri, 23 Feb 2024 19:14:26 +0000 (21:14 +0200)
committerIgor Ryzhov <iryzhov@nfware.com>
Fri, 23 Feb 2024 23:39:18 +0000 (01:39 +0200)
commit38b85e0c2bc555b8827dbd2cb6515b6febf548b4
tree386d4ad5dc2b6d63bb913177fc1e6bf3e2e0b4aa
parenteae228c52d4256542ab94038be263a29dbffa4ce
lib: fix order of northbound operations

When ordering operations, destroys must always come before other
operations, to correctly cover the change of a "case" in a "choice".

The problem can be reproduced with the following commands:
```
access-list test seq 1 permit 10.0.0.0/8
access-list test seq 1 permit host 10.0.0.1
access-list test seq 1 permit 10.0.0.0/8
```

Before this commit, the order of changes would be the following:
- `access-list test seq 1 permit 10.0.0.0/8`
  - `modify` for `ipv4-prefix`
- `access-list test seq 1 permit host 10.0.0.1`
  - `destroy` for `ipv4-prefix`
  - `modify` for `host`
- `access-list test seq 1 permit 10.0.0.0/8`
  - `modify` for `ipv4-prefix`
  - `destroy` for `host`

As `destroy` for `host` is called last, it rewrites the fields that were
filled by `modify` callback of `ipv4-prefix`. This commit fixes this
problem by always calling `destroy` callbacks first.

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