summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-06-23 11:54:43 +0200
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:04:18 +0100
commitb72bd2c20e0f9767c0bd0f1aff97d3a77ed681c5 (patch)
tree99628cf69f916a6b58cd0e5e23548588ceb2290e /src
parent53cb490ec6c1ebe1e19d28fdf504d0d6d57e9425 (diff)
sd-netlink: drop NETLINK_TYPE_META
The NETLINK_TYPE_META pseudo-type is actually equivalent to an empty nested type. Drop it and define an empty type-system instead. This also has the nice side-effect that m->container_type_system[0] is never NULL (which has really nasty side-effects if you try to read attributes).
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.c13
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
index 4ee0e6148..c4573b609 100644
--- a/src/libsystemd/sd-netlink/netlink-types.c
+++ b/src/libsystemd/sd-netlink/netlink-types.c
@@ -53,6 +53,15 @@ struct NLTypeSystem {
static const NLTypeSystem rtnl_link_type_system;
+static const NLType empty_types[1] = {
+ /* fake array to avoid .types==NULL, which denotes invalid type-systems */
+};
+
+static const NLTypeSystem empty_type_system = {
+ .count = 0,
+ .types = empty_types,
+};
+
static const NLType rtnl_link_info_data_veth_types[VETH_INFO_MAX + 1] = {
[VETH_INFO_PEER] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_link_type_system, .size = sizeof(struct ifinfomsg) },
};
@@ -450,8 +459,8 @@ static const NLTypeSystem rtnl_neigh_type_system = {
};
static const NLType rtnl_types[RTM_MAX + 1] = {
- [NLMSG_DONE] = { .type = NETLINK_TYPE_META, .size = 0 },
- [NLMSG_ERROR] = { .type = NETLINK_TYPE_META, .size = sizeof(struct nlmsgerr) },
+ [NLMSG_DONE] = { .type = NETLINK_TYPE_NESTED, .type_system = &empty_type_system, .size = 0 },
+ [NLMSG_ERROR] = { .type = NETLINK_TYPE_NESTED, .type_system = &empty_type_system, .size = sizeof(struct nlmsgerr) },
[RTM_NEWLINK] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_link_type_system, .size = sizeof(struct ifinfomsg) },
[RTM_DELLINK] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_link_type_system, .size = sizeof(struct ifinfomsg) },
[RTM_GETLINK] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_link_type_system, .size = sizeof(struct ifinfomsg) },
diff --git a/src/libsystemd/sd-netlink/netlink-types.h b/src/libsystemd/sd-netlink/netlink-types.h
index 91f6a1d1c..d64229546 100644
--- a/src/libsystemd/sd-netlink/netlink-types.h
+++ b/src/libsystemd/sd-netlink/netlink-types.h
@@ -23,7 +23,6 @@
enum {
NETLINK_TYPE_UNSPEC,
- NETLINK_TYPE_META,
NETLINK_TYPE_U8, /* NLA_U8 */
NETLINK_TYPE_U16, /* NLA_U16 */
NETLINK_TYPE_U32, /* NLA_U32 */