mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
net: openvswitch: add log message for error case
As requested by upstream OVS, added some error messages in the validate_and_copy_dec_ttl function. Includes a small cleanup, which removes an unnecessary parameter from the dec_ttl_exception_handler() function. Reported-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Link: https://lore.kernel.org/r/161054576573.26637.18396634650212670580.stgit@ebuild Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
3bf679e2f7
commit
a5317f3b06
@@ -957,14 +957,14 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
|
|||||||
|
|
||||||
static int dec_ttl_exception_handler(struct datapath *dp, struct sk_buff *skb,
|
static int dec_ttl_exception_handler(struct datapath *dp, struct sk_buff *skb,
|
||||||
struct sw_flow_key *key,
|
struct sw_flow_key *key,
|
||||||
const struct nlattr *attr, bool last)
|
const struct nlattr *attr)
|
||||||
{
|
{
|
||||||
/* The first attribute is always 'OVS_DEC_TTL_ATTR_ACTION'. */
|
/* The first attribute is always 'OVS_DEC_TTL_ATTR_ACTION'. */
|
||||||
struct nlattr *actions = nla_data(attr);
|
struct nlattr *actions = nla_data(attr);
|
||||||
|
|
||||||
if (nla_len(actions))
|
if (nla_len(actions))
|
||||||
return clone_execute(dp, skb, key, 0, nla_data(actions),
|
return clone_execute(dp, skb, key, 0, nla_data(actions),
|
||||||
nla_len(actions), last, false);
|
nla_len(actions), true, false);
|
||||||
|
|
||||||
consume_skb(skb);
|
consume_skb(skb);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1418,11 +1418,9 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
|
|||||||
|
|
||||||
case OVS_ACTION_ATTR_DEC_TTL:
|
case OVS_ACTION_ATTR_DEC_TTL:
|
||||||
err = execute_dec_ttl(skb, key);
|
err = execute_dec_ttl(skb, key);
|
||||||
if (err == -EHOSTUNREACH) {
|
if (err == -EHOSTUNREACH)
|
||||||
err = dec_ttl_exception_handler(dp, skb, key,
|
return dec_ttl_exception_handler(dp, skb,
|
||||||
a, true);
|
key, a);
|
||||||
return err;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2515,15 +2515,25 @@ static int validate_and_copy_dec_ttl(struct net *net,
|
|||||||
if (type > OVS_DEC_TTL_ATTR_MAX)
|
if (type > OVS_DEC_TTL_ATTR_MAX)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!type || attrs[type])
|
if (!type || attrs[type]) {
|
||||||
|
OVS_NLERR(log, "Duplicate or invalid key (type %d).",
|
||||||
|
type);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
attrs[type] = a;
|
attrs[type] = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
actions = attrs[OVS_DEC_TTL_ATTR_ACTION];
|
if (rem) {
|
||||||
if (rem || !actions || (nla_len(actions) && nla_len(actions) < NLA_HDRLEN))
|
OVS_NLERR(log, "Message has %d unknown bytes.", rem);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
actions = attrs[OVS_DEC_TTL_ATTR_ACTION];
|
||||||
|
if (!actions || (nla_len(actions) && nla_len(actions) < NLA_HDRLEN)) {
|
||||||
|
OVS_NLERR(log, "Missing valid actions attribute.");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
start = add_nested_action_start(sfa, OVS_ACTION_ATTR_DEC_TTL, log);
|
start = add_nested_action_start(sfa, OVS_ACTION_ATTR_DEC_TTL, log);
|
||||||
if (start < 0)
|
if (start < 0)
|
||||||
|
Reference in New Issue
Block a user