|
@@ -126,14 +126,16 @@ int lwtunnel_build_state(u16 encap_type,
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(lwtunnel_build_state);
|
|
EXPORT_SYMBOL(lwtunnel_build_state);
|
|
|
|
|
|
-int lwtunnel_valid_encap_type(u16 encap_type)
|
|
|
|
|
|
+int lwtunnel_valid_encap_type(u16 encap_type, struct netlink_ext_ack *extack)
|
|
{
|
|
{
|
|
const struct lwtunnel_encap_ops *ops;
|
|
const struct lwtunnel_encap_ops *ops;
|
|
int ret = -EINVAL;
|
|
int ret = -EINVAL;
|
|
|
|
|
|
if (encap_type == LWTUNNEL_ENCAP_NONE ||
|
|
if (encap_type == LWTUNNEL_ENCAP_NONE ||
|
|
- encap_type > LWTUNNEL_ENCAP_MAX)
|
|
|
|
|
|
+ encap_type > LWTUNNEL_ENCAP_MAX) {
|
|
|
|
+ NL_SET_ERR_MSG(extack, "Unknown lwt encapsulation type");
|
|
return ret;
|
|
return ret;
|
|
|
|
+ }
|
|
|
|
|
|
rcu_read_lock();
|
|
rcu_read_lock();
|
|
ops = rcu_dereference(lwtun_encaps[encap_type]);
|
|
ops = rcu_dereference(lwtun_encaps[encap_type]);
|
|
@@ -153,11 +155,16 @@ int lwtunnel_valid_encap_type(u16 encap_type)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
- return ops ? 0 : -EOPNOTSUPP;
|
|
|
|
|
|
+ ret = ops ? 0 : -EOPNOTSUPP;
|
|
|
|
+ if (ret < 0)
|
|
|
|
+ NL_SET_ERR_MSG(extack, "lwt encapsulation type not supported");
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(lwtunnel_valid_encap_type);
|
|
EXPORT_SYMBOL(lwtunnel_valid_encap_type);
|
|
|
|
|
|
-int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int remaining)
|
|
|
|
|
|
+int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int remaining,
|
|
|
|
+ struct netlink_ext_ack *extack)
|
|
{
|
|
{
|
|
struct rtnexthop *rtnh = (struct rtnexthop *)attr;
|
|
struct rtnexthop *rtnh = (struct rtnexthop *)attr;
|
|
struct nlattr *nla_entype;
|
|
struct nlattr *nla_entype;
|
|
@@ -174,7 +181,8 @@ int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int remaining)
|
|
if (nla_entype) {
|
|
if (nla_entype) {
|
|
encap_type = nla_get_u16(nla_entype);
|
|
encap_type = nla_get_u16(nla_entype);
|
|
|
|
|
|
- if (lwtunnel_valid_encap_type(encap_type) != 0)
|
|
|
|
|
|
+ if (lwtunnel_valid_encap_type(encap_type,
|
|
|
|
+ extack) != 0)
|
|
return -EOPNOTSUPP;
|
|
return -EOPNOTSUPP;
|
|
}
|
|
}
|
|
}
|
|
}
|