Skip to content

Commit

Permalink
net: sched: act: mirred: add extack support
Browse files Browse the repository at this point in the history
This patch adds extack support for TC mirred action.

Cc: David Ahern <[email protected]>
Signed-off-by: Alexander Aring <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alexander Aring authored and davem330 committed Feb 16, 2018
1 parent b362014 commit 1d4760c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions net/sched/act_mirred.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
bool exists = false;
int ret;

if (!nla)
if (!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, NULL);
}
ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, extack);
if (ret < 0)
return ret;
if (!tb[TCA_MIRRED_PARMS])
if (!tb[TCA_MIRRED_PARMS]) {
NL_SET_ERR_MSG_MOD(extack, "Missing required mirred parameters");
return -EINVAL;
}
parm = nla_data(tb[TCA_MIRRED_PARMS]);

exists = tcf_idr_check(tn, parm->index, a, bind);
Expand All @@ -102,6 +106,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
default:
if (exists)
tcf_idr_release(*a, bind);
NL_SET_ERR_MSG_MOD(extack, "Unknown mirred option");
return -EINVAL;
}
if (parm->ifindex) {
Expand All @@ -117,8 +122,10 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
}

if (!exists) {
if (!dev)
if (!dev) {
NL_SET_ERR_MSG_MOD(extack, "Specified device does not exist");
return -EINVAL;
}
ret = tcf_idr_create(tn, parm->index, est, a,
&act_mirred_ops, bind, true);
if (ret)
Expand Down

0 comments on commit 1d4760c

Please sign in to comment.