netlink: make validation more configurable for future strictness
We currently have two levels of strict validation: 1) liberal (default) - undefined (type >= max) & NLA_UNSPEC attributes accepted - attribute length >= expected accepted - garbage at end of message accepted 2) strict (opt-in) - NLA_UNSPEC attributes accepted - attribute length >= expected accepted Split out parsing strictness into four different options: * TRAILING - check that there's no trailing data after parsing attributes (in message or nested) * MAXTYPE - reject attrs > max known type * UNSPEC - reject attributes with NLA_UNSPEC policy entries * STRICT_ATTRS - strictly validate attribute size The default for future things should be *everything*. The current *_strict() is a combination of TRAILING and MAXTYPE, and is renamed to _deprecated_strict(). The current regular parsing has none of this, and is renamed to *_parse_deprecated(). Additionally it allows us to selectively set one of the new flags even on old policies. Notably, the UNSPEC flag could be useful in this case, since it can be arranged (by filling in the policy) to not be an incompatible userspace ABI change, but would then going forward prevent forgetting attribute entries. Similar can apply to the POLICY flag. We end up with the following renames: * nla_parse -> nla_parse_deprecated * nla_parse_strict -> nla_parse_deprecated_strict * nlmsg_parse -> nlmsg_parse_deprecated * nlmsg_parse_strict -> nlmsg_parse_deprecated_strict * nla_parse_nested -> nla_parse_nested_deprecated * nla_validate_nested -> nla_validate_nested_deprecated Using spatch, of course: @@ expression TB, MAX, HEAD, LEN, POL, EXT; @@ -nla_parse(TB, MAX, HEAD, LEN, POL, EXT) +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT) @@ expression NLH, HDRLEN, TB, MAX, POL, EXT; @@ -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT) +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT) @@ expression NLH, HDRLEN, TB, MAX, POL, EXT; @@ -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT) +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT) @@ expression TB, MAX, NLA, POL, EXT; @@ -nla_parse_nested(TB, MAX, NLA, POL, EXT) +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT) @@ expression START, MAX, POL, EXT; @@ -nla_validate_nested(START, MAX, POL, EXT) +nla_validate_nested_deprecated(START, MAX, POL, EXT) @@ expression NLH, HDRLEN, MAX, POL, EXT; @@ -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT) +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT) For this patch, don't actually add the strict, non-renamed versions yet so that it breaks compile if I get it wrong. Also, while at it, make nla_validate and nla_parse go down to a common __nla_validate_parse() function to avoid code duplication. Ultimately, this allows us to have very strict validation for every new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the next patch, while existing things will continue to work as is. In effect then, this adds fully strict validation for any new command. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6f455f5f4e
commit
8cb081746c
@@ -849,7 +849,8 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
||||
int err;
|
||||
|
||||
if (name == NULL) {
|
||||
err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL,
|
||||
extack);
|
||||
if (err < 0)
|
||||
goto err_out;
|
||||
err = -EINVAL;
|
||||
@@ -964,7 +965,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
|
||||
int err;
|
||||
int i;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX_PRIO, nla, NULL,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1099,7 +1101,7 @@ static struct tc_action *tcf_action_get_1(struct net *net, struct nlattr *nla,
|
||||
int index;
|
||||
int err;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, extack);
|
||||
if (err < 0)
|
||||
goto err_out;
|
||||
|
||||
@@ -1153,7 +1155,7 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
|
||||
|
||||
b = skb_tail_pointer(skb);
|
||||
|
||||
err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_ACT_MAX, nla, NULL, extack);
|
||||
if (err < 0)
|
||||
goto err_out;
|
||||
|
||||
@@ -1282,7 +1284,8 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
|
||||
size_t attr_size = 0;
|
||||
struct tc_action *actions[TCA_ACT_MAX_PRIO] = {};
|
||||
|
||||
ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL, extack);
|
||||
ret = nla_parse_nested_deprecated(tb, TCA_ACT_MAX_PRIO, nla, NULL,
|
||||
extack);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -1384,8 +1387,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n,
|
||||
!netlink_capable(skb, CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ROOT_MAX, NULL,
|
||||
extack);
|
||||
ret = nlmsg_parse_deprecated(n, sizeof(struct tcamsg), tca,
|
||||
TCA_ROOT_MAX, NULL, extack);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -1436,13 +1439,12 @@ static struct nlattr *find_dump_kind(struct nlattr **nla)
|
||||
if (tb1 == NULL)
|
||||
return NULL;
|
||||
|
||||
if (nla_parse(tb, TCA_ACT_MAX_PRIO, nla_data(tb1),
|
||||
NLMSG_ALIGN(nla_len(tb1)), NULL, NULL) < 0)
|
||||
if (nla_parse_deprecated(tb, TCA_ACT_MAX_PRIO, nla_data(tb1), NLMSG_ALIGN(nla_len(tb1)), NULL, NULL) < 0)
|
||||
return NULL;
|
||||
|
||||
if (tb[1] == NULL)
|
||||
return NULL;
|
||||
if (nla_parse_nested(tb2, TCA_ACT_MAX, tb[1], NULL, NULL) < 0)
|
||||
if (nla_parse_nested_deprecated(tb2, TCA_ACT_MAX, tb[1], NULL, NULL) < 0)
|
||||
return NULL;
|
||||
kind = tb2[TCA_ACT_KIND];
|
||||
|
||||
@@ -1466,8 +1468,8 @@ static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
u32 msecs_since = 0;
|
||||
u32 act_count = 0;
|
||||
|
||||
ret = nlmsg_parse(cb->nlh, sizeof(struct tcamsg), tb, TCA_ROOT_MAX,
|
||||
tcaa_policy, cb->extack);
|
||||
ret = nlmsg_parse_deprecated(cb->nlh, sizeof(struct tcamsg), tb,
|
||||
TCA_ROOT_MAX, tcaa_policy, cb->extack);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@@ -293,7 +293,8 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
|
||||
if (!nla)
|
||||
return -EINVAL;
|
||||
|
||||
ret = nla_parse_nested(tb, TCA_ACT_BPF_MAX, nla, act_bpf_policy, NULL);
|
||||
ret = nla_parse_nested_deprecated(tb, TCA_ACT_BPF_MAX, nla,
|
||||
act_bpf_policy, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@@ -111,8 +111,8 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla,
|
||||
if (!nla)
|
||||
return -EINVAL;
|
||||
|
||||
ret = nla_parse_nested(tb, TCA_CONNMARK_MAX, nla, connmark_policy,
|
||||
NULL);
|
||||
ret = nla_parse_nested_deprecated(tb, TCA_CONNMARK_MAX, nla,
|
||||
connmark_policy, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@@ -61,7 +61,8 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
|
||||
if (nla == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_CSUM_MAX, nla, csum_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_CSUM_MAX, nla, csum_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -74,7 +74,8 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla,
|
||||
if (nla == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_GACT_MAX, nla, gact_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_GACT_MAX, nla, gact_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -486,7 +486,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
|
||||
int ret = 0;
|
||||
int err;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_IFE_MAX, nla, ife_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_IFE_MAX, nla, ife_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -567,8 +568,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
|
||||
INIT_LIST_HEAD(&ife->metalist);
|
||||
|
||||
if (tb[TCA_IFE_METALST]) {
|
||||
err = nla_parse_nested(tb2, IFE_META_MAX, tb[TCA_IFE_METALST],
|
||||
NULL, NULL);
|
||||
err = nla_parse_nested_deprecated(tb2, IFE_META_MAX,
|
||||
tb[TCA_IFE_METALST], NULL,
|
||||
NULL);
|
||||
if (err)
|
||||
goto metadata_parse_err;
|
||||
err = populate_metalist(ife, tb2, exists, rtnl_held);
|
||||
|
@@ -113,7 +113,8 @@ static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla,
|
||||
if (nla == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_IPT_MAX, nla, ipt_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_IPT_MAX, nla, ipt_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -111,7 +111,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
|
||||
NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed");
|
||||
return -EINVAL;
|
||||
}
|
||||
ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, extack);
|
||||
ret = nla_parse_nested_deprecated(tb, TCA_MIRRED_MAX, nla,
|
||||
mirred_policy, extack);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!tb[TCA_MIRRED_PARMS]) {
|
||||
|
@@ -52,7 +52,8 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
|
||||
if (nla == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_NAT_MAX, nla, nat_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_NAT_MAX, nla, nat_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -70,8 +70,9 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla,
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_PEDIT_KEY_EX_MAX, ka,
|
||||
pedit_key_ex_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_PEDIT_KEY_EX_MAX,
|
||||
ka, pedit_key_ex_policy,
|
||||
NULL);
|
||||
if (err)
|
||||
goto err_out;
|
||||
|
||||
@@ -158,7 +159,8 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_PEDIT_MAX, nla, pedit_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_PEDIT_MAX, nla,
|
||||
pedit_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -100,7 +100,8 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
|
||||
if (nla == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_POLICE_MAX, nla, police_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_POLICE_MAX, nla,
|
||||
police_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -53,7 +53,8 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
|
||||
|
||||
if (!nla)
|
||||
return -EINVAL;
|
||||
ret = nla_parse_nested(tb, TCA_SAMPLE_MAX, nla, sample_policy, NULL);
|
||||
ret = nla_parse_nested_deprecated(tb, TCA_SAMPLE_MAX, nla,
|
||||
sample_policy, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!tb[TCA_SAMPLE_PARMS] || !tb[TCA_SAMPLE_RATE] ||
|
||||
|
@@ -104,7 +104,8 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
|
||||
if (nla == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_DEF_MAX, nla, simple_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_DEF_MAX, nla, simple_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -114,7 +114,8 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
|
||||
if (nla == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_SKBEDIT_MAX, nla, skbedit_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
|
||||
skbedit_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -102,7 +102,8 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
|
||||
if (!nla)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_SKBMOD_MAX, nla, skbmod_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_SKBMOD_MAX, nla,
|
||||
skbmod_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -76,8 +76,9 @@ tunnel_key_copy_geneve_opt(const struct nlattr *nla, void *dst, int dst_len,
|
||||
int err, data_len, opt_len;
|
||||
u8 *data;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX,
|
||||
nla, geneve_opt_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb,
|
||||
TCA_TUNNEL_KEY_ENC_OPT_GENEVE_MAX,
|
||||
nla, geneve_opt_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -125,8 +126,8 @@ static int tunnel_key_copy_opts(const struct nlattr *nla, u8 *dst,
|
||||
int err, rem, opt_len, len = nla_len(nla), opts_len = 0;
|
||||
const struct nlattr *attr, *head = nla_data(nla);
|
||||
|
||||
err = nla_validate(head, len, TCA_TUNNEL_KEY_ENC_OPTS_MAX,
|
||||
enc_opts_policy, extack);
|
||||
err = nla_validate_deprecated(head, len, TCA_TUNNEL_KEY_ENC_OPTS_MAX,
|
||||
enc_opts_policy, extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -235,8 +236,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_TUNNEL_KEY_MAX, nla, tunnel_key_policy,
|
||||
extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_TUNNEL_KEY_MAX, nla,
|
||||
tunnel_key_policy, extack);
|
||||
if (err < 0) {
|
||||
NL_SET_ERR_MSG(extack, "Failed to parse nested tunnel key attributes");
|
||||
return err;
|
||||
|
@@ -124,7 +124,8 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
|
||||
if (!nla)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_VLAN_MAX, nla, vlan_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_VLAN_MAX, nla, vlan_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -2006,7 +2006,8 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
|
||||
replay:
|
||||
tp_created = 0;
|
||||
|
||||
err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack);
|
||||
err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
|
||||
rtm_tca_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -2217,7 +2218,8 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
|
||||
if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack);
|
||||
err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
|
||||
rtm_tca_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -2366,7 +2368,8 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
|
||||
int err;
|
||||
bool rtnl_held = false;
|
||||
|
||||
err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack);
|
||||
err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
|
||||
rtm_tca_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -2558,8 +2561,8 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
if (nlmsg_len(cb->nlh) < sizeof(*tcm))
|
||||
return skb->len;
|
||||
|
||||
err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, NULL,
|
||||
cb->extack);
|
||||
err = nlmsg_parse_deprecated(cb->nlh, sizeof(*tcm), tca, TCA_MAX,
|
||||
NULL, cb->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -2806,7 +2809,8 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n,
|
||||
return -EPERM;
|
||||
|
||||
replay:
|
||||
err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack);
|
||||
err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
|
||||
rtm_tca_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -2937,8 +2941,8 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
if (nlmsg_len(cb->nlh) < sizeof(*tcm))
|
||||
return skb->len;
|
||||
|
||||
err = nlmsg_parse(cb->nlh, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy,
|
||||
cb->extack);
|
||||
err = nlmsg_parse_deprecated(cb->nlh, sizeof(*tcm), tca, TCA_MAX,
|
||||
rtm_tca_policy, cb->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@@ -185,8 +185,8 @@ static int basic_change(struct net *net, struct sk_buff *in_skb,
|
||||
if (tca[TCA_OPTIONS] == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS],
|
||||
basic_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS],
|
||||
basic_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -468,8 +468,8 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
|
||||
if (tca[TCA_OPTIONS] == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
ret = nla_parse_nested(tb, TCA_BPF_MAX, tca[TCA_OPTIONS], bpf_policy,
|
||||
NULL);
|
||||
ret = nla_parse_nested_deprecated(tb, TCA_BPF_MAX, tca[TCA_OPTIONS],
|
||||
bpf_policy, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@@ -104,8 +104,9 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
|
||||
goto errout;
|
||||
new->handle = handle;
|
||||
new->tp = tp;
|
||||
err = nla_parse_nested(tb, TCA_CGROUP_MAX, tca[TCA_OPTIONS],
|
||||
cgroup_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_CGROUP_MAX,
|
||||
tca[TCA_OPTIONS], cgroup_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
goto errout;
|
||||
|
||||
|
@@ -408,7 +408,8 @@ static int flow_change(struct net *net, struct sk_buff *in_skb,
|
||||
if (opt == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_FLOW_MAX, opt, flow_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_FLOW_MAX, opt, flow_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -884,8 +884,9 @@ static int fl_set_geneve_opt(const struct nlattr *nla, struct fl_flow_key *key,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX,
|
||||
nla, geneve_opt_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb,
|
||||
TCA_FLOWER_KEY_ENC_OPT_GENEVE_MAX,
|
||||
nla, geneve_opt_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -947,18 +948,18 @@ static int fl_set_enc_opt(struct nlattr **tb, struct fl_flow_key *key,
|
||||
const struct nlattr *nla_enc_key, *nla_opt_key, *nla_opt_msk = NULL;
|
||||
int err, option_len, key_depth, msk_depth = 0;
|
||||
|
||||
err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS],
|
||||
TCA_FLOWER_KEY_ENC_OPTS_MAX,
|
||||
enc_opts_policy, extack);
|
||||
err = nla_validate_nested_deprecated(tb[TCA_FLOWER_KEY_ENC_OPTS],
|
||||
TCA_FLOWER_KEY_ENC_OPTS_MAX,
|
||||
enc_opts_policy, extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
nla_enc_key = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS]);
|
||||
|
||||
if (tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]) {
|
||||
err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK],
|
||||
TCA_FLOWER_KEY_ENC_OPTS_MAX,
|
||||
enc_opts_policy, extack);
|
||||
err = nla_validate_nested_deprecated(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK],
|
||||
TCA_FLOWER_KEY_ENC_OPTS_MAX,
|
||||
enc_opts_policy, extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -1513,8 +1514,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
|
||||
goto errout_mask_alloc;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS],
|
||||
fl_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_FLOWER_MAX,
|
||||
tca[TCA_OPTIONS], fl_policy, NULL);
|
||||
if (err < 0)
|
||||
goto errout_tb;
|
||||
|
||||
@@ -1852,8 +1853,8 @@ static void *fl_tmplt_create(struct net *net, struct tcf_chain *chain,
|
||||
tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL);
|
||||
if (!tb)
|
||||
return ERR_PTR(-ENOBUFS);
|
||||
err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS],
|
||||
fl_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_FLOWER_MAX,
|
||||
tca[TCA_OPTIONS], fl_policy, NULL);
|
||||
if (err)
|
||||
goto errout_tb;
|
||||
|
||||
|
@@ -263,7 +263,8 @@ static int fw_change(struct net *net, struct sk_buff *in_skb,
|
||||
if (!opt)
|
||||
return handle ? -EINVAL : 0; /* Succeed if it is old method. */
|
||||
|
||||
err = nla_parse_nested(tb, TCA_FW_MAX, opt, fw_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_FW_MAX, opt, fw_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -181,8 +181,8 @@ static int mall_change(struct net *net, struct sk_buff *in_skb,
|
||||
if (head)
|
||||
return -EEXIST;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_MATCHALL_MAX, tca[TCA_OPTIONS],
|
||||
mall_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_MATCHALL_MAX,
|
||||
tca[TCA_OPTIONS], mall_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -484,7 +484,8 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
|
||||
if (opt == NULL)
|
||||
return handle ? -EINVAL : 0;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_ROUTE4_MAX, opt, route4_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_ROUTE4_MAX, opt,
|
||||
route4_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -497,7 +497,8 @@ static int rsvp_change(struct net *net, struct sk_buff *in_skb,
|
||||
if (opt == NULL)
|
||||
return handle ? -EINVAL : 0;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_RSVP_MAX, opt, rsvp_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_RSVP_MAX, opt, rsvp_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -510,7 +510,8 @@ tcindex_change(struct net *net, struct sk_buff *in_skb,
|
||||
if (!opt)
|
||||
return 0;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_TCINDEX_MAX, opt, tcindex_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_TCINDEX_MAX, opt,
|
||||
tcindex_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -884,7 +884,8 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
|
||||
}
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_U32_MAX, opt, u32_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_U32_MAX, opt, u32_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -120,8 +120,8 @@ static int em_ipt_change(struct net *net, void *data, int data_len,
|
||||
struct xt_match *match;
|
||||
int mdata_len, ret;
|
||||
|
||||
ret = nla_parse(tb, TCA_EM_IPT_MAX, data, data_len, em_ipt_policy,
|
||||
NULL);
|
||||
ret = nla_parse_deprecated(tb, TCA_EM_IPT_MAX, data, data_len,
|
||||
em_ipt_policy, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@@ -912,7 +912,8 @@ static int em_meta_change(struct net *net, void *data, int len,
|
||||
struct tcf_meta_hdr *hdr;
|
||||
struct meta_match *meta = NULL;
|
||||
|
||||
err = nla_parse(tb, TCA_EM_META_MAX, data, len, meta_policy, NULL);
|
||||
err = nla_parse_deprecated(tb, TCA_EM_META_MAX, data, len,
|
||||
meta_policy, NULL);
|
||||
if (err < 0)
|
||||
goto errout;
|
||||
|
||||
|
@@ -314,7 +314,8 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla,
|
||||
if (!nla)
|
||||
return 0;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, em_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_EMATCH_TREE_MAX, nla,
|
||||
em_policy, NULL);
|
||||
if (err < 0)
|
||||
goto errout;
|
||||
|
||||
|
@@ -479,7 +479,8 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt,
|
||||
u16 *tab = NULL;
|
||||
int err;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_STAB_MAX, opt, stab_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_STAB_MAX, opt, stab_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return ERR_PTR(err);
|
||||
if (!tb[TCA_STAB_BASE]) {
|
||||
@@ -1423,8 +1424,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
|
||||
!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy,
|
||||
extack);
|
||||
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
||||
rtm_tca_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1508,8 +1509,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
|
||||
|
||||
replay:
|
||||
/* Reinit, just in case something touches this. */
|
||||
err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy,
|
||||
extack);
|
||||
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
||||
rtm_tca_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1743,8 +1744,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
idx = 0;
|
||||
ASSERT_RTNL();
|
||||
|
||||
err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX,
|
||||
rtm_tca_policy, cb->extack);
|
||||
err = nlmsg_parse_deprecated(nlh, sizeof(struct tcmsg), tca, TCA_MAX,
|
||||
rtm_tca_policy, cb->extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1972,8 +1973,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n,
|
||||
!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy,
|
||||
extack);
|
||||
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
||||
rtm_tca_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -223,7 +223,8 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
|
||||
if (opt == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
error = nla_parse_nested(tb, TCA_ATM_MAX, opt, atm_policy, NULL);
|
||||
error = nla_parse_nested_deprecated(tb, TCA_ATM_MAX, opt, atm_policy,
|
||||
NULL);
|
||||
if (error < 0)
|
||||
return error;
|
||||
|
||||
|
@@ -2531,7 +2531,8 @@ static int cake_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (!opt)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_CAKE_MAX, opt, cake_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_CAKE_MAX, opt, cake_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -1149,7 +1149,8 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1473,7 +1474,8 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt, cbq_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -358,7 +358,8 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
struct tc_cbs_qopt *qopt;
|
||||
int err;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_CBS_MAX, opt, cbs_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_CBS_MAX, opt, cbs_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -358,7 +358,8 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (opt == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_CHOKE_MAX, opt, choke_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_CHOKE_MAX, opt,
|
||||
choke_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -141,7 +141,8 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (!opt)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_CODEL_MAX, opt, codel_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_CODEL_MAX, opt,
|
||||
codel_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -70,7 +70,8 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_DRR_MAX, opt, drr_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_DRR_MAX, opt, drr_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -132,7 +132,8 @@ static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent,
|
||||
if (!opt)
|
||||
goto errout;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_DSMARK_MAX, opt, dsmark_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_DSMARK_MAX, opt,
|
||||
dsmark_policy, NULL);
|
||||
if (err < 0)
|
||||
goto errout;
|
||||
|
||||
@@ -353,7 +354,8 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_DSMARK_MAX, opt, dsmark_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_DSMARK_MAX, opt,
|
||||
dsmark_policy, NULL);
|
||||
if (err < 0)
|
||||
goto errout;
|
||||
|
||||
|
@@ -351,7 +351,8 @@ static int etf_init(struct Qdisc *sch, struct nlattr *opt,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_ETF_MAX, opt, etf_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_ETF_MAX, opt, etf_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -684,7 +684,8 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (!opt)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_FQ_MAX, opt, fq_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_FQ_MAX, opt, fq_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -387,8 +387,8 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (!opt)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_FQ_CODEL_MAX, opt, fq_codel_policy,
|
||||
NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_FQ_CODEL_MAX, opt,
|
||||
fq_codel_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if (tb[TCA_FQ_CODEL_FLOWS]) {
|
||||
|
@@ -538,7 +538,8 @@ static void gred_vq_apply(struct gred_sched *table, const struct nlattr *entry)
|
||||
struct nlattr *tb[TCA_GRED_VQ_MAX + 1];
|
||||
u32 dp;
|
||||
|
||||
nla_parse_nested(tb, TCA_GRED_VQ_MAX, entry, gred_vq_policy, NULL);
|
||||
nla_parse_nested_deprecated(tb, TCA_GRED_VQ_MAX, entry,
|
||||
gred_vq_policy, NULL);
|
||||
|
||||
dp = nla_get_u32(tb[TCA_GRED_VQ_DP]);
|
||||
|
||||
@@ -568,8 +569,8 @@ static int gred_vq_validate(struct gred_sched *table, u32 cdp,
|
||||
int err;
|
||||
u32 dp;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_GRED_VQ_MAX, entry, gred_vq_policy,
|
||||
extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_GRED_VQ_MAX, entry,
|
||||
gred_vq_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -610,8 +611,8 @@ static int gred_vqs_validate(struct gred_sched *table, u32 cdp,
|
||||
const struct nlattr *attr;
|
||||
int rem, err;
|
||||
|
||||
err = nla_validate_nested(vqs, TCA_GRED_VQ_ENTRY_MAX,
|
||||
gred_vqe_policy, extack);
|
||||
err = nla_validate_nested_deprecated(vqs, TCA_GRED_VQ_ENTRY_MAX,
|
||||
gred_vqe_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -650,7 +651,8 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (opt == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_GRED_MAX, opt, gred_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -737,7 +739,8 @@ static int gred_init(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (!opt)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_GRED_MAX, opt, gred_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_GRED_MAX, opt, gred_policy,
|
||||
extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -926,7 +926,8 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||
if (opt == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_HFSC_MAX, opt, hfsc_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_HFSC_MAX, opt, hfsc_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -518,7 +518,8 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (!opt)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_HHF_MAX, opt, hhf_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_HHF_MAX, opt, hhf_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -1012,7 +1012,8 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_HTB_MAX, opt, htb_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_HTB_MAX, opt, htb_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@@ -1310,7 +1311,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
|
||||
if (!opt)
|
||||
goto failure;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_HTB_MAX, opt, htb_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_HTB_MAX, opt, htb_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
goto failure;
|
||||
|
||||
|
@@ -125,8 +125,9 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,
|
||||
int nested_len = nla_len(nla) - NLA_ALIGN(len);
|
||||
|
||||
if (nested_len >= nla_attr_size(0))
|
||||
return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
|
||||
nested_len, policy, NULL);
|
||||
return nla_parse_deprecated(tb, maxtype,
|
||||
nla_data(nla) + NLA_ALIGN(len),
|
||||
nested_len, policy, NULL);
|
||||
|
||||
memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
|
||||
return 0;
|
||||
|
@@ -935,8 +935,9 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,
|
||||
}
|
||||
|
||||
if (nested_len >= nla_attr_size(0))
|
||||
return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
|
||||
nested_len, policy, NULL);
|
||||
return nla_parse_deprecated(tb, maxtype,
|
||||
nla_data(nla) + NLA_ALIGN(len),
|
||||
nested_len, policy, NULL);
|
||||
|
||||
memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
|
||||
return 0;
|
||||
|
@@ -216,7 +216,8 @@ static int pie_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (!opt)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_PIE_MAX, opt, pie_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_PIE_MAX, opt, pie_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -410,8 +410,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb, TCA_QFQ_MAX, tca[TCA_OPTIONS], qfq_policy,
|
||||
NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_QFQ_MAX, tca[TCA_OPTIONS],
|
||||
qfq_policy, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -205,7 +205,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
if (opt == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_RED_MAX, opt, red_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_RED_MAX, opt, red_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -499,7 +499,8 @@ static int sfb_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
int err;
|
||||
|
||||
if (opt) {
|
||||
err = nla_parse_nested(tb, TCA_SFB_MAX, opt, sfb_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_SFB_MAX, opt,
|
||||
sfb_policy, NULL);
|
||||
if (err < 0)
|
||||
return -EINVAL;
|
||||
|
||||
|
@@ -310,8 +310,8 @@ static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry,
|
||||
struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { };
|
||||
int err;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_TAPRIO_SCHED_ENTRY_MAX, n,
|
||||
entry_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_TAPRIO_SCHED_ENTRY_MAX, n,
|
||||
entry_policy, NULL);
|
||||
if (err < 0) {
|
||||
NL_SET_ERR_MSG(extack, "Could not parse nested entry");
|
||||
return -EINVAL;
|
||||
@@ -334,8 +334,8 @@ static int parse_sched_single_entry(struct nlattr *n,
|
||||
u32 index;
|
||||
int err;
|
||||
|
||||
err = nla_parse_nested(tb_list, TCA_TAPRIO_SCHED_MAX,
|
||||
n, entry_list_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb_list, TCA_TAPRIO_SCHED_MAX, n,
|
||||
entry_list_policy, NULL);
|
||||
if (err < 0) {
|
||||
NL_SET_ERR_MSG(extack, "Could not parse nested entry");
|
||||
return -EINVAL;
|
||||
@@ -346,9 +346,10 @@ static int parse_sched_single_entry(struct nlattr *n,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = nla_parse_nested(tb_entry, TCA_TAPRIO_SCHED_ENTRY_MAX,
|
||||
tb_list[TCA_TAPRIO_SCHED_ENTRY],
|
||||
entry_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb_entry,
|
||||
TCA_TAPRIO_SCHED_ENTRY_MAX,
|
||||
tb_list[TCA_TAPRIO_SCHED_ENTRY],
|
||||
entry_policy, NULL);
|
||||
if (err < 0) {
|
||||
NL_SET_ERR_MSG(extack, "Could not parse nested entry");
|
||||
return -EINVAL;
|
||||
@@ -644,8 +645,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
int i, err, size;
|
||||
ktime_t start;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_TAPRIO_ATTR_MAX, opt,
|
||||
taprio_policy, extack);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_TAPRIO_ATTR_MAX, opt,
|
||||
taprio_policy, extack);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@@ -308,7 +308,8 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
s64 buffer, mtu;
|
||||
u64 rate64 = 0, prate64 = 0;
|
||||
|
||||
err = nla_parse_nested(tb, TCA_TBF_MAX, opt, tbf_policy, NULL);
|
||||
err = nla_parse_nested_deprecated(tb, TCA_TBF_MAX, opt, tbf_policy,
|
||||
NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
Reference in New Issue
Block a user