summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques de Laval <Jacques.De.Laval@westermo.com>2022-04-25 16:20:02 +0200
committerThomas Haller <thaller@redhat.com>2022-04-26 14:26:57 +0200
commit2effffe7979dda638108fba26b763fa5acd6edac (patch)
treed8ac3790d7ea5fc815a311d510208326402ef16e
parent5ecd56cdc7f3729a0c9b6663073d3dfa96776f74 (diff)
downloadlibnl-2effffe7979dda638108fba26b763fa5acd6edac.tar.gz
route/link: Set the cache ops when cloning a link
The cache ops needs to be included in a cloned link for link methods to work as expected. Signed-off-by: Jacques de Laval <Jacques.De.Laval@westermo.com> https://github.com/thom311/libnl/pull/311
-rw-r--r--lib/route/link.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/route/link.c b/lib/route/link.c
index c1916e72..df8ea5bb 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -333,6 +333,9 @@ static int link_clone(struct nl_object *_dst, struct nl_object *_src)
if ((err = do_foreach_af(src, af_clone, dst)) < 0)
return err;
+ if (src->l_af_ops)
+ dst->l_af_ops = af_lookup_and_alloc(dst, src->l_af_ops->ao_family);
+
if (src->l_phys_port_id)
if (!(dst->l_phys_port_id = nl_data_clone(src->l_phys_port_id)))
return -NLE_NOMEM;