@@ -148,7 +148,8 @@ struct rtnl_af_ops {
size_t (*get_link_af_size)(const struct net_device *dev);
int (*validate_link_af)(const struct net_device *dev,
- const struct nlattr *attr);
+ const struct nlattr *attr,
+ bool strict);
int (*set_link_af)(struct net_device *dev,
const struct nlattr *attr);
};
@@ -1491,7 +1491,8 @@ static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[])
return -EOPNOTSUPP;
if (af_ops->validate_link_af) {
- err = af_ops->validate_link_af(dev, af);
+ err = af_ops->validate_link_af(dev, af,
+ false);
if (err < 0)
return err;
}
@@ -1679,7 +1679,8 @@ static const struct nla_policy inet_af_policy[IFLA_INET_MAX+1] = {
};
static int inet_validate_link_af(const struct net_device *dev,
- const struct nlattr *nla)
+ const struct nlattr *nla,
+ bool strict)
{
struct nlattr *a, *tb[IFLA_INET_MAX+1];
int err, rem;
@@ -1687,7 +1688,8 @@ static int inet_validate_link_af(const struct net_device *dev,
if (dev && !__in_dev_get_rtnl(dev))
return -EAFNOSUPPORT;
- err = nla_parse_nested(tb, IFLA_INET_MAX, nla, inet_af_policy);
+ err = nla_strict_parse_nested(tb, IFLA_INET_MAX, strict, nla,
+ inet_af_policy);
if (err < 0)
return err;
@@ -4876,14 +4876,16 @@ static const struct nla_policy inet6_af_policy[IFLA_INET6_MAX + 1] = {
};
static int inet6_validate_link_af(const struct net_device *dev,
- const struct nlattr *nla)
+ const struct nlattr *nla,
+ bool strict)
{
struct nlattr *tb[IFLA_INET6_MAX + 1];
if (dev && !__in6_dev_get(dev))
return -EAFNOSUPPORT;
- return nla_parse_nested(tb, IFLA_INET6_MAX, nla, inet6_af_policy);
+ return nla_strict_parse_nested(tb, IFLA_INET6_MAX, strict, nla,
+ inet6_af_policy);
}
static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
This is in preparation for rtnetlink to be able to handle strict attribute checking. Nothing complicated here, just pass the parameter through. Signed-off-by: Jiri Benc <jbenc@redhat.com> --- include/net/rtnetlink.h | 3 ++- net/core/rtnetlink.c | 3 ++- net/ipv4/devinet.c | 6 ++++-- net/ipv6/addrconf.c | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-)