diff options
author | Alexander Aring <aring@mojatatu.com> | 2018-02-15 10:55:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-16 16:05:51 -0500 |
commit | 1d4760c75d4f8c7c73f040f0261a09cf1481fdec (patch) | |
tree | 7bd43e597cc4d3eba5e085102568a9cf6ad98471 | |
parent | b36201455aa0749e8708ef97ed9c1c9ece29a113 (diff) |
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>
-rw-r--r-- | net/sched/act_mirred.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 05c2ebe92eca..fd34015331ab 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -80,13 +80,17 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, | |||
80 | bool exists = false; | 80 | bool exists = false; |
81 | int ret; | 81 | int ret; |
82 | 82 | ||
83 | if (!nla) | 83 | if (!nla) { |
84 | NL_SET_ERR_MSG_MOD(extack, "Mirred requires attributes to be passed"); | ||
84 | return -EINVAL; | 85 | 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); | ||
86 | if (ret < 0) | 88 | if (ret < 0) |
87 | return ret; | 89 | 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"); | ||
89 | return -EINVAL; | 92 | return -EINVAL; |
93 | } | ||
90 | parm = nla_data(tb[TCA_MIRRED_PARMS]); | 94 | parm = nla_data(tb[TCA_MIRRED_PARMS]); |
91 | 95 | ||
92 | exists = tcf_idr_check(tn, parm->index, a, bind); | 96 | 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 | default: | 106 | default: |
103 | if (exists) | 107 | if (exists) |
104 | tcf_idr_release(*a, bind); | 108 | tcf_idr_release(*a, bind); |
109 | NL_SET_ERR_MSG_MOD(extack, "Unknown mirred option"); | ||
105 | return -EINVAL; | 110 | return -EINVAL; |
106 | } | 111 | } |
107 | if (parm->ifindex) { | 112 | if (parm->ifindex) { |
@@ -117,8 +122,10 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, | |||
117 | } | 122 | } |
118 | 123 | ||
119 | if (!exists) { | 124 | if (!exists) { |
120 | if (!dev) | 125 | if (!dev) { |
126 | NL_SET_ERR_MSG_MOD(extack, "Specified device does not exist"); | ||
121 | return -EINVAL; | 127 | return -EINVAL; |
128 | } | ||
122 | ret = tcf_idr_create(tn, parm->index, est, a, | 129 | ret = tcf_idr_create(tn, parm->index, est, a, |
123 | &act_mirred_ops, bind, true); | 130 | &act_mirred_ops, bind, true); |
124 | if (ret) | 131 | if (ret) |