diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2015-02-05 08:39:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-06 15:51:33 -0500 |
commit | 11b1f8288d4341af5d755281c871bff6c3e270dd (patch) | |
tree | 863d1fa76be5090f6276b50e0f8ca033acf3fe63 | |
parent | 37c85c3498c5538db050ff287e346127dbc16f7c (diff) |
ipv6: addrconf: add missing validate_link_af handler
We still need a validate_link_af() handler with an appropriate nla policy,
similarly as we have in IPv4 case, otherwise size validations are not being
done properly in that case.
Fixes: f53adae4eae5 ("net: ipv6: add tokenized interface identifier support")
Fixes: bc91b0f07ada ("ipv6: addrconf: implement address generation modes")
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/addrconf.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 62900aee4c58..754e683240f9 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -4587,6 +4587,22 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token) | |||
4587 | return 0; | 4587 | return 0; |
4588 | } | 4588 | } |
4589 | 4589 | ||
4590 | static const struct nla_policy inet6_af_policy[IFLA_INET6_MAX + 1] = { | ||
4591 | [IFLA_INET6_ADDR_GEN_MODE] = { .type = NLA_U8 }, | ||
4592 | [IFLA_INET6_TOKEN] = { .len = sizeof(struct in6_addr) }, | ||
4593 | }; | ||
4594 | |||
4595 | static int inet6_validate_link_af(const struct net_device *dev, | ||
4596 | const struct nlattr *nla) | ||
4597 | { | ||
4598 | struct nlattr *tb[IFLA_INET6_MAX + 1]; | ||
4599 | |||
4600 | if (dev && !__in6_dev_get(dev)) | ||
4601 | return -EAFNOSUPPORT; | ||
4602 | |||
4603 | return nla_parse_nested(tb, IFLA_INET6_MAX, nla, inet6_af_policy); | ||
4604 | } | ||
4605 | |||
4590 | static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla) | 4606 | static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla) |
4591 | { | 4607 | { |
4592 | int err = -EINVAL; | 4608 | int err = -EINVAL; |
@@ -5408,6 +5424,7 @@ static struct rtnl_af_ops inet6_ops = { | |||
5408 | .family = AF_INET6, | 5424 | .family = AF_INET6, |
5409 | .fill_link_af = inet6_fill_link_af, | 5425 | .fill_link_af = inet6_fill_link_af, |
5410 | .get_link_af_size = inet6_get_link_af_size, | 5426 | .get_link_af_size = inet6_get_link_af_size, |
5427 | .validate_link_af = inet6_validate_link_af, | ||
5411 | .set_link_af = inet6_set_link_af, | 5428 | .set_link_af = inet6_set_link_af, |
5412 | }; | 5429 | }; |
5413 | 5430 | ||