]> git.puffer.fish Git - matthieu/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)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Sun, 25 Feb 2024 21:55:03 +0000 (21:55 +0000)
commitf9b30889e3ca942aa1d9746014946af404a3c1b9
tree4354cb09ebb44ebaf1132ce494263ba3b3011402
parent0caa1711e1b4009768c02ea855da02c4519f032a
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>
(cherry picked from commit 38b85e0c2bc555b8827dbd2cb6515b6febf548b4)
lib/northbound.c