- if ((type == IFLA_LINKINFO && m->n_containers == 0) ||
- (type == IFLA_INFO_DATA && m->n_containers == 1 &&
- GET_CONTAINER(m, 0)->rta_type == IFLA_LINKINFO))
- return add_rtattr(m, type, NULL, 0);
- else if (type == VETH_INFO_PEER && m->n_containers == 2 &&
- GET_CONTAINER(m, 1)->rta_type == IFLA_INFO_DATA &&
- GET_CONTAINER(m, 0)->rta_type == IFLA_LINKINFO)
- return add_rtattr(m, type, NULL, sizeof(struct ifinfomsg));
- }
+ r = add_rtattr(m, type, NULL, size);
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+int sd_rtnl_message_open_container_union(sd_rtnl_message *m, unsigned short type, const char *key) {
+ const NLTypeSystemUnion *type_system_union;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+
+ r = type_system_get_type_system_union(m->container_type_system[m->n_containers], &type_system_union, type);
+ if (r < 0)
+ return r;
+
+ r = type_system_union_get_type_system(type_system_union,
+ &m->container_type_system[m->n_containers + 1],
+ key);
+ if (r < 0)
+ return r;