summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@bisdn.de>2024-06-12 08:08:12 (GMT)
committerJonas Gorski <jonas.gorski@bisdn.de>2024-08-30 08:54:19 (GMT)
commit22b6cf5c95fcc57f3dcf41056db9b776f60a5f56 (patch)
tree6decf36f54a18e973676434516a31165b1de1dde /lib
parente1c75bff81f6fef5fc159b403f2efcf0e1e11f7b (diff)
downloadlibnl-22b6cf5c95fcc57f3dcf41056db9b776f60a5f56.zip
libnl-22b6cf5c95fcc57f3dcf41056db9b776f60a5f56.tar.gz
libnl-22b6cf5c95fcc57f3dcf41056db9b776f60a5f56.tar.bz2
link/bonding: implement io_clone()
Implement the missing rtnl_link_info_ops::io_clone(), so that cloning a bond link will retain its data. Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/route/link/bonding.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/route/link/bonding.c b/lib/route/link/bonding.c
index 6657961..ec3661d 100644
--- a/lib/route/link/bonding.c
+++ b/lib/route/link/bonding.c
@@ -59,6 +59,26 @@ static void bond_info_free(struct rtnl_link *link)
_nl_clear_free(&link->l_info);
}
+static int bond_info_clone(struct rtnl_link *dst, struct rtnl_link *src)
+{
+ struct bond_info *bond_dst, *bond_src = src->l_info;
+ int err;
+
+ _nl_assert(bond_src);
+
+ err = bond_info_alloc(dst);
+ if (err)
+ return err;
+
+ bond_dst = dst->l_info;
+
+ _nl_assert(bond_dst);
+
+ *bond_dst = *bond_src;
+
+ return 0;
+}
+
static int bond_put_attrs(struct nl_msg *msg, struct rtnl_link *link)
{
struct bond_info *bn = link->l_info;
@@ -93,6 +113,7 @@ nla_put_failure:
static struct rtnl_link_info_ops bonding_info_ops = {
.io_name = "bond",
.io_alloc = bond_info_alloc,
+ .io_clone = bond_info_clone,
.io_put_attrs = bond_put_attrs,
.io_free = bond_info_free,
};