Commit 1d4760c7 authored by Alexander Aring's avatar Alexander Aring Committed by David S. Miller

net: sched: act: mirred: add extack support

This patch adds extack support for TC mirred action.

Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: default avatarAlexander Aring <aring@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b3620145
...@@ -80,13 +80,17 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, ...@@ -80,13 +80,17 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
bool exists = false; bool exists = false;
int ret; int ret;
if (!nla) if (!nla) {
NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed");
return -EINVAL; return -EINVAL;
ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, NULL); }
ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, extack);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!tb[TCA_MIRRED_PARMS]) if (!tb[TCA_MIRRED_PARMS]) {
NL_SET_ERR_MSG_MOD(extack, "Missing required mirred parameters");
return -EINVAL; return -EINVAL;
}
parm = nla_data(tb[TCA_MIRRED_PARMS]); parm = nla_data(tb[TCA_MIRRED_PARMS]);
exists = tcf_idr_check(tn, parm->index, a, bind); exists = tcf_idr_check(tn, parm->index, a, bind);
...@@ -102,6 +106,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, ...@@ -102,6 +106,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
default: default:
if (exists) if (exists)
tcf_idr_release(*a, bind); tcf_idr_release(*a, bind);
NL_SET_ERR_MSG_MOD(extack, "Unknown mirred option");
return -EINVAL; return -EINVAL;
} }
if (parm->ifindex) { if (parm->ifindex) {
...@@ -117,8 +122,10 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, ...@@ -117,8 +122,10 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
} }
if (!exists) { if (!exists) {
if (!dev) if (!dev) {
NL_SET_ERR_MSG_MOD(extack, "Specified device does not exist");
return -EINVAL; return -EINVAL;
}
ret = tcf_idr_create(tn, parm->index, est, a, ret = tcf_idr_create(tn, parm->index, est, a,
&act_mirred_ops, bind, true); &act_mirred_ops, bind, true);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment