summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-netlink
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-netlink')
-rw-r--r--src/libsystemd/sd-netlink/netlink-message.c4
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.c10
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.h7
3 files changed, 14 insertions, 7 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c
index 1780585f08..1245371f7b 100644
--- a/src/libsystemd/sd-netlink/netlink-message.c
+++ b/src/libsystemd/sd-netlink/netlink-message.c
@@ -754,7 +754,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
r = rtnl_message_parse(m,
&m->rta_offset_tb[m->n_containers],
&m->rta_tb_size[m->n_containers],
- type_system->max,
+ type_system_get_max(type_system),
container,
size);
if (r < 0) {
@@ -890,7 +890,7 @@ int sd_netlink_message_rewind(sd_netlink_message *m) {
r = rtnl_message_parse(m,
&m->rta_offset_tb[m->n_containers],
&m->rta_tb_size[m->n_containers],
- type_system->max,
+ type_system_get_max(type_system),
(struct rtattr*)((uint8_t*)NLMSG_DATA(m->hdr) + NLMSG_ALIGN(size)),
NLMSG_PAYLOAD(m->hdr, size));
if (r < 0)
diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
index 7715ff8a44..70dbd4f8dc 100644
--- a/src/libsystemd/sd-netlink/netlink-types.c
+++ b/src/libsystemd/sd-netlink/netlink-types.c
@@ -46,6 +46,11 @@ struct NLType {
const NLTypeSystemUnion *type_system_union;
};
+struct NLTypeSystem {
+ uint16_t max;
+ const NLType *types;
+};
+
static const NLTypeSystem rtnl_link_type_system;
static const NLType rtnl_link_info_data_veth_types[VETH_INFO_MAX + 1] = {
@@ -495,6 +500,11 @@ void type_get_type_system_union(const NLType *nl_type, const NLTypeSystemUnion *
*ret = nl_type->type_system_union;
}
+uint16_t type_system_get_max(const NLTypeSystem *type_system) {
+ assert(type_system);
+ return type_system->max;
+}
+
int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, uint16_t type) {
const NLType *nl_type;
diff --git a/src/libsystemd/sd-netlink/netlink-types.h b/src/libsystemd/sd-netlink/netlink-types.h
index cb6a78fb3e..c11bdbdf4c 100644
--- a/src/libsystemd/sd-netlink/netlink-types.h
+++ b/src/libsystemd/sd-netlink/netlink-types.h
@@ -53,15 +53,12 @@ struct NLTypeSystemUnion {
const NLTypeSystem *type_systems;
};
-struct NLTypeSystem {
- uint16_t max;
- const NLType *types;
-};
-
uint16_t type_get_type(const NLType *type);
size_t type_get_size(const NLType *type);
void type_get_type_system(const NLType *type, const NLTypeSystem **ret);
void type_get_type_system_union(const NLType *type, const NLTypeSystemUnion **ret);
+
+uint16_t type_system_get_max(const NLTypeSystem *type_system);
int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, uint16_t type);
int type_system_get_type_system(const NLTypeSystem *type_system, const NLTypeSystem **ret, uint16_t type);
int type_system_get_type_system_union(const NLTypeSystem *type_system, const NLTypeSystemUnion **ret, uint16_t type);