Skip to content

Commit

Permalink
cache: fix new object in callback v2 on updated objects
Browse files Browse the repository at this point in the history
When calling the callback v2 for objects that were updated, we pass the
update ("obj") instead of the updated object ("old") as new.

Presumably this wasn't intended, so pass the updated object as new.

This avoids weird updates where the new object is significantly smaller
than the old one. E.g. for IPv6 multipath route updates, old would be
the full route with all nexthops, while new would be a partial route
with only the added/removed nexthop.

Fixes: 66d032a ("cache_mngr: add include callback v2")
Signed-off-by: Jonas Gorski <[email protected]>

#381
  • Loading branch information
KanjiMonster authored and thom311 committed Apr 26, 2024
1 parent 46cae1b commit 3a43faa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ static int cache_include(struct nl_cache *cache, struct nl_object *obj,
*/
if (nl_object_update(old, obj) == 0) {
if (cb_v2) {
cb_v2(cache, clone, obj, diff,
cb_v2(cache, clone, old, diff,
NL_ACT_CHANGE, data);
nl_object_put(clone);
} else if (cb)
Expand Down

0 comments on commit 3a43faa

Please sign in to comment.