aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target/linux/generic/files/drivers/net/phy/swconfig.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/swconfig.c b/target/linux/generic/files/drivers/net/phy/swconfig.c
index abf1a4504b..e7da45d0f7 100644
--- a/target/linux/generic/files/drivers/net/phy/swconfig.c
+++ b/target/linux/generic/files/drivers/net/phy/swconfig.c
@@ -591,12 +591,15 @@ swconfig_parse_ports(struct sk_buff *msg, struct nlattr *head,
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;
@@ -618,10 +621,12 @@ swconfig_parse_link(struct sk_buff *msg, struct nlattr *nla,
{
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;
@@ -1000,6 +1005,9 @@ swconfig_done(struct netlink_callback *cb)
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,
@@ -1007,6 +1015,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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,
@@ -1014,6 +1025,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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,
@@ -1021,6 +1035,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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,
@@ -1028,6 +1045,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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,
@@ -1035,6 +1055,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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,
@@ -1042,6 +1065,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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)
@@ -1050,6 +1076,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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)
@@ -1058,6 +1087,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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)
@@ -1066,6 +1098,9 @@ static struct genl_ops swconfig_ops[] = {
},
{
.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,