summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd/sd-netlink/netlink-message.c4
-rw-r--r--src/libsystemd/sd-netlink/netlink-socket.c2
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.c7
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.h2
4 files changed, 7 insertions, 8 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c
index e39e4c646c..a935b821f6 100644
--- a/src/libsystemd/sd-netlink/netlink-message.c
+++ b/src/libsystemd/sd-netlink/netlink-message.c
@@ -68,7 +68,7 @@ int message_new(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t type) {
size_t size;
int r;
- r = type_system_get_type(NULL, &nl_type, type);
+ r = type_system_get_type(&type_system_root, &nl_type, type);
if (r < 0)
return r;
@@ -874,7 +874,7 @@ int sd_netlink_message_rewind(sd_netlink_message *m) {
assert(m->hdr);
- r = type_system_get_type(NULL, &nl_type, m->hdr->nlmsg_type);
+ r = type_system_get_type(&type_system_root, &nl_type, m->hdr->nlmsg_type);
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-netlink/netlink-socket.c b/src/libsystemd/sd-netlink/netlink-socket.c
index db4efb58d4..84ff7c38c9 100644
--- a/src/libsystemd/sd-netlink/netlink-socket.c
+++ b/src/libsystemd/sd-netlink/netlink-socket.c
@@ -243,7 +243,7 @@ int socket_read_message(sd_netlink *rtnl) {
}
/* check that we support this message type */
- r = type_system_get_type(NULL, &nl_type, new_msg->nlmsg_type);
+ r = type_system_get_type(&type_system_root, &nl_type, new_msg->nlmsg_type);
if (r < 0) {
if (r == -EOPNOTSUPP)
log_debug("sd-netlink: ignored message with unknown type: %i",
diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
index d22194ad71..40548dcbc0 100644
--- a/src/libsystemd/sd-netlink/netlink-types.c
+++ b/src/libsystemd/sd-netlink/netlink-types.c
@@ -476,7 +476,7 @@ static const NLType rtnl_types[RTM_MAX + 1] = {
[RTM_GETNEIGH] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_neigh_type_system, .size = sizeof(struct ndmsg) },
};
-const NLTypeSystem rtnl_type_system = {
+const NLTypeSystem type_system_root = {
.count = ELEMENTSOF(rtnl_types),
.types = rtnl_types,
};
@@ -518,10 +518,7 @@ int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, ui
const NLType *nl_type;
assert(ret);
-
- if (!type_system)
- type_system = &rtnl_type_system;
-
+ assert(type_system);
assert(type_system->types);
if (type >= type_system->count)
diff --git a/src/libsystemd/sd-netlink/netlink-types.h b/src/libsystemd/sd-netlink/netlink-types.h
index d642295464..b1ef7af421 100644
--- a/src/libsystemd/sd-netlink/netlink-types.h
+++ b/src/libsystemd/sd-netlink/netlink-types.h
@@ -52,6 +52,8 @@ struct NLTypeSystemUnion {
const NLTypeSystem *type_systems;
};
+extern const NLTypeSystem type_system_root;
+
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);