along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <stddef.h>
#include <stdint.h>
#include <sys/socket.h>
#include <linux/netlink.h>
[IFLA_INET6_ADDR_GEN_MODE] = { .type = NLA_U8 },
};
-static const NLTypeSystem rtnl_af_spec_type_systems[AF_MAX] = {
- [AF_INET6] = { .max = ELEMENTSOF(rtnl_af_spec_inet6_types) - 1,
- .types = rtnl_af_spec_inet6_types },
+static const NLTypeSystem rtnl_af_spec_inet6_type_system = {
+ .max = ELEMENTSOF(rtnl_af_spec_inet6_types) - 1,
+ .types = rtnl_af_spec_inet6_types,
};
-static const NLTypeSystemUnion rtnl_af_spec_type_system_union = {
- .num = AF_MAX,
- .type_systems = rtnl_af_spec_type_systems,
- .match_type = NL_MATCH_PROTOCOL,
+static const NLType rtnl_af_spec_types[AF_MAX + 1] = {
+ [AF_INET6] = { .type = NLA_NESTED, .type_system = &rtnl_af_spec_inet6_type_system },
+};
+
+static const NLTypeSystem rtnl_af_spec_type_system = {
+ .max = ELEMENTSOF(rtnl_af_spec_types) - 1,
+ .types = rtnl_af_spec_types,
};
static const NLType rtnl_link_types[IFLA_MAX + 1 ] = {
[IFLA_VF_PORTS] = { .type = NLA_NESTED },
[IFLA_PORT_SELF] = { .type = NLA_NESTED },
*/
- [IFLA_AF_SPEC] = { .type = NLA_NESTED, .type_system_union = &rtnl_af_spec_type_system_union },
+ [IFLA_AF_SPEC] = { .type = NLA_NESTED, .type_system = &rtnl_af_spec_type_system },
/*
[IFLA_VF_PORTS],
[IFLA_PORT_SELF],
if (r < 0)
return r;
- assert_return(nl_type->type == NLA_NESTED, -EINVAL);
-
+ assert(nl_type->type == NLA_NESTED);
assert(nl_type->type_system);
*ret = nl_type->type_system;
if (r < 0)
return r;
- assert_return(nl_type->type == NLA_UNION, -EINVAL);
-
+ assert(nl_type->type == NLA_UNION);
assert(nl_type->type_system_union);
*ret = nl_type->type_system_union;
int type;
assert(type_system_union);
- assert_return(type_system_union->match_type == NL_MATCH_SIBLING, -EINVAL);
+ assert(type_system_union->match_type == NL_MATCH_SIBLING);
assert(type_system_union->lookup);
assert(type_system_union->type_systems);
assert(ret);
assert(type_system_union);
assert(type_system_union->type_systems);
+ assert(type_system_union->match_type == NL_MATCH_PROTOCOL);
assert(ret);
- assert_return(type_system_union->match_type == NL_MATCH_PROTOCOL, -EINVAL);
- assert_return(protocol < type_system_union->num, -EINVAL);
if (protocol >= type_system_union->num)
return -ENOTSUP;
type_system = &type_system_union->type_systems[protocol];
-
- if (!type_system)
+ if (type_system->max == 0)
return -ENOTSUP;
*ret = type_system;