[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d18f6a3-78da-2dee-d715-39a043870eec@kernel.org>
Date: Sun, 3 Jul 2022 13:07:33 -0600
From: David Ahern <dsahern@...nel.org>
To: David Lamparter <equinox@...c24.net>, netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next 2/2] net: ip6mr: add RTM_GETROUTE netlink op
On 7/1/22 1:58 AM, David Lamparter wrote:
> @@ -2510,6 +2512,121 @@ static void mrt6msg_netlink_event(const struct mr_table *mrt, struct sk_buff *pk
> rtnl_set_sk_err(net, RTNLGRP_IPV6_MROUTE_R, -ENOBUFS);
> }
>
> +static int ip6mr_rtm_valid_getroute_req(struct sk_buff *skb,
> + const struct nlmsghdr *nlh,
> + struct nlattr **tb,
> + struct netlink_ext_ack *extack)
> +{
> + struct rtmsg *rtm;
> + int i, err;
> +
> + if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*rtm))) {
> + NL_SET_ERR_MSG(extack, "ipv6: Invalid header for multicast route get request");
> + return -EINVAL;
> + }
> +
> + if (!netlink_strict_get_check(skb))
> + return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX,
> + rtm_ipv6_policy, extack);
Since this is new code, it always operates in strict mode.
> +
> + rtm = nlmsg_data(nlh);
> + if ((rtm->rtm_src_len && rtm->rtm_src_len != 128) ||
> + (rtm->rtm_dst_len && rtm->rtm_dst_len != 128) ||
> + rtm->rtm_tos || rtm->rtm_table || rtm->rtm_protocol ||
> + rtm->rtm_scope || rtm->rtm_type || rtm->rtm_flags) {
> + NL_SET_ERR_MSG(extack, "ipv6: Invalid values in header for multicast route get request");
> + return -EINVAL;
> + }
> +
> + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX,
> + rtm_ipv6_policy, extack);
nlmsg_parse here.
Powered by blists - more mailing lists