Skip to content

Commit 1d4760c

Browse files
Alexander Aringdavem330
authored andcommitted
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: Alexander Aring <aring@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b362014 commit 1d4760c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

net/sched/act_mirred.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,17 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
8080
bool exists = false;
8181
int ret;
8282

83-
if (!nla)
83+
if (!nla) {
84+
NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed");
8485
return -EINVAL;
85-
ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, NULL);
86+
}
87+
ret = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy, extack);
8688
if (ret < 0)
8789
return ret;
88-
if (!tb[TCA_MIRRED_PARMS])
90+
if (!tb[TCA_MIRRED_PARMS]) {
91+
NL_SET_ERR_MSG_MOD(extack, "Missing required mirred parameters");
8992
return -EINVAL;
93+
}
9094
parm = nla_data(tb[TCA_MIRRED_PARMS]);
9195

9296
exists = tcf_idr_check(tn, parm->index, a, bind);
@@ -102,6 +106,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
102106
default:
103107
if (exists)
104108
tcf_idr_release(*a, bind);
109+
NL_SET_ERR_MSG_MOD(extack, "Unknown mirred option");
105110
return -EINVAL;
106111
}
107112
if (parm->ifindex) {
@@ -117,8 +122,10 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
117122
}
118123

119124
if (!exists) {
120-
if (!dev)
125+
if (!dev) {
126+
NL_SET_ERR_MSG_MOD(extack, "Specified device does not exist");
121127
return -EINVAL;
128+
}
122129
ret = tcf_idr_create(tn, parm->index, est, a,
123130
&act_mirred_ops, bind, true);
124131
if (ret)

0 commit comments

Comments
 (0)