port = &val->value.ports[val->len];
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ if (nla_parse_nested_deprecated(tb, SWITCH_PORT_ATTR_MAX, nla,
+ port_policy, NULL))
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
if (nla_parse_nested(tb, SWITCH_PORT_ATTR_MAX, nla,
- port_policy))
+ port_policy, NULL))
#else
if (nla_parse_nested(tb, SWITCH_PORT_ATTR_MAX, nla,
- port_policy, NULL))
+ port_policy))
#endif
return -EINVAL;
{
struct nlattr *tb[SWITCH_LINK_ATTR_MAX + 1];
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)
- if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy))
-#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ if (nla_parse_nested_deprecated(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL))
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL))
+#else
+ if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy))
#endif
return -EINVAL;
static struct genl_ops swconfig_ops[] = {
{
.cmd = SWITCH_CMD_LIST_GLOBAL,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.doit = swconfig_list_attrs,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
.policy = switch_policy,
},
{
.cmd = SWITCH_CMD_LIST_VLAN,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.doit = swconfig_list_attrs,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
.policy = switch_policy,
},
{
.cmd = SWITCH_CMD_LIST_PORT,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.doit = swconfig_list_attrs,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
.policy = switch_policy,
},
{
.cmd = SWITCH_CMD_GET_GLOBAL,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.doit = swconfig_get_attr,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
.policy = switch_policy,
},
{
.cmd = SWITCH_CMD_GET_VLAN,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.doit = swconfig_get_attr,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
.policy = switch_policy,
},
{
.cmd = SWITCH_CMD_GET_PORT,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.doit = swconfig_get_attr,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
.policy = switch_policy,
},
{
.cmd = SWITCH_CMD_SET_GLOBAL,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.flags = GENL_ADMIN_PERM,
.doit = swconfig_set_attr,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
},
{
.cmd = SWITCH_CMD_SET_VLAN,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.flags = GENL_ADMIN_PERM,
.doit = swconfig_set_attr,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
},
{
.cmd = SWITCH_CMD_SET_PORT,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.flags = GENL_ADMIN_PERM,
.doit = swconfig_set_attr,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
},
{
.cmd = SWITCH_CMD_GET_SWITCH,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
+ .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
+#endif
.dumpit = swconfig_dump_switches,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
.policy = switch_policy,