Commit 1057c55f authored by Alexander Aring's avatar Alexander Aring Committed by David S. Miller

net: sched: cls: add extack support for tcf_change_indev

This patch adds extack handling for the tcf_change_indev function which
is common used by TC classifier implementations.

Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: default avatarAlexander Aring <aring@mojatatu.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 571acf21
...@@ -557,13 +557,16 @@ static inline int tcf_valid_offset(const struct sk_buff *skb, ...@@ -557,13 +557,16 @@ static inline int tcf_valid_offset(const struct sk_buff *skb,
#include <net/net_namespace.h> #include <net/net_namespace.h>
static inline int static inline int
tcf_change_indev(struct net *net, struct nlattr *indev_tlv) tcf_change_indev(struct net *net, struct nlattr *indev_tlv,
struct netlink_ext_ack *extack)
{ {
char indev[IFNAMSIZ]; char indev[IFNAMSIZ];
struct net_device *dev; struct net_device *dev;
if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) {
NL_SET_ERR_MSG(extack, "Interface name too long");
return -EINVAL; return -EINVAL;
}
dev = __dev_get_by_name(net, indev); dev = __dev_get_by_name(net, indev);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
......
...@@ -526,13 +526,14 @@ static void fl_set_key_ip(struct nlattr **tb, ...@@ -526,13 +526,14 @@ static void fl_set_key_ip(struct nlattr **tb,
} }
static int fl_set_key(struct net *net, struct nlattr **tb, static int fl_set_key(struct net *net, struct nlattr **tb,
struct fl_flow_key *key, struct fl_flow_key *mask) struct fl_flow_key *key, struct fl_flow_key *mask,
struct netlink_ext_ack *extack)
{ {
__be16 ethertype; __be16 ethertype;
int ret = 0; int ret = 0;
#ifdef CONFIG_NET_CLS_IND #ifdef CONFIG_NET_CLS_IND
if (tb[TCA_FLOWER_INDEV]) { if (tb[TCA_FLOWER_INDEV]) {
int err = tcf_change_indev(net, tb[TCA_FLOWER_INDEV]); int err = tcf_change_indev(net, tb[TCA_FLOWER_INDEV], extack);
if (err < 0) if (err < 0)
return err; return err;
key->indev_ifindex = err; key->indev_ifindex = err;
...@@ -841,7 +842,7 @@ static int fl_set_parms(struct net *net, struct tcf_proto *tp, ...@@ -841,7 +842,7 @@ static int fl_set_parms(struct net *net, struct tcf_proto *tp,
tcf_bind_filter(tp, &f->res, base); tcf_bind_filter(tp, &f->res, base);
} }
err = fl_set_key(net, tb, &f->key, &mask->key); err = fl_set_key(net, tb, &f->key, &mask->key, extack);
if (err) if (err)
return err; return err;
......
...@@ -239,7 +239,7 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp, ...@@ -239,7 +239,7 @@ static int fw_set_parms(struct net *net, struct tcf_proto *tp,
#ifdef CONFIG_NET_CLS_IND #ifdef CONFIG_NET_CLS_IND
if (tb[TCA_FW_INDEV]) { if (tb[TCA_FW_INDEV]) {
int ret; int ret;
ret = tcf_change_indev(net, tb[TCA_FW_INDEV]); ret = tcf_change_indev(net, tb[TCA_FW_INDEV], extack);
if (ret < 0) if (ret < 0)
return ret; return ret;
f->ifindex = ret; f->ifindex = ret;
......
...@@ -804,7 +804,7 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp, ...@@ -804,7 +804,7 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp,
#ifdef CONFIG_NET_CLS_IND #ifdef CONFIG_NET_CLS_IND
if (tb[TCA_U32_INDEV]) { if (tb[TCA_U32_INDEV]) {
int ret; int ret;
ret = tcf_change_indev(net, tb[TCA_U32_INDEV]); ret = tcf_change_indev(net, tb[TCA_U32_INDEV], extack);
if (ret < 0) if (ret < 0)
return -EINVAL; return -EINVAL;
n->ifindex = ret; n->ifindex = 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