* [PATCH net-next] net: openvswitch: add log message for error case
@ 2021-01-13 13:50 Eelco Chaudron
2021-01-13 14:29 ` Flavio Leitner
2021-01-15 0:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Eelco Chaudron @ 2021-01-13 13:50 UTC (permalink / raw)
To: netdev; +Cc: davem, dev, kuba, pshelar, bindiyakurle, fbl
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>
---
net/openvswitch/actions.c | 12 +++++-------
net/openvswitch/flow_netlink.c | 14 ++++++++++++--
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index e8902a7e60f2..92a0b67b2728 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -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,
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'. */
struct nlattr *actions = nla_data(attr);
if (nla_len(actions))
return clone_execute(dp, skb, key, 0, nla_data(actions),
- nla_len(actions), last, false);
+ nla_len(actions), true, false);
consume_skb(skb);
return 0;
@@ -1418,11 +1418,9 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
case OVS_ACTION_ATTR_DEC_TTL:
err = execute_dec_ttl(skb, key);
- if (err == -EHOSTUNREACH) {
- err = dec_ttl_exception_handler(dp, skb, key,
- a, true);
- return err;
- }
+ if (err == -EHOSTUNREACH)
+ return dec_ttl_exception_handler(dp, skb,
+ key, a);
break;
}
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 4c5c2331e764..fd1f809e9bc1 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -2515,15 +2515,25 @@ static int validate_and_copy_dec_ttl(struct net *net,
if (type > OVS_DEC_TTL_ATTR_MAX)
continue;
- if (!type || attrs[type])
+ if (!type || attrs[type]) {
+ OVS_NLERR(log, "Duplicate or invalid key (type %d).",
+ type);
return -EINVAL;
+ }
attrs[type] = a;
}
+ if (rem) {
+ OVS_NLERR(log, "Message has %d unknown bytes.", rem);
+ return -EINVAL;
+ }
+
actions = attrs[OVS_DEC_TTL_ATTR_ACTION];
- if (rem || !actions || (nla_len(actions) && nla_len(actions) < NLA_HDRLEN))
+ 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);
if (start < 0)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: openvswitch: add log message for error case
2021-01-13 13:50 [PATCH net-next] net: openvswitch: add log message for error case Eelco Chaudron
@ 2021-01-13 14:29 ` Flavio Leitner
2021-01-15 0:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Flavio Leitner @ 2021-01-13 14:29 UTC (permalink / raw)
To: Eelco Chaudron; +Cc: netdev, davem, dev, kuba, pshelar, bindiyakurle
On Wed, Jan 13, 2021 at 02:50:00PM +0100, Eelco Chaudron wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: openvswitch: add log message for error case
2021-01-13 13:50 [PATCH net-next] net: openvswitch: add log message for error case Eelco Chaudron
2021-01-13 14:29 ` Flavio Leitner
@ 2021-01-15 0:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-15 0:50 UTC (permalink / raw)
To: Eelco Chaudron; +Cc: netdev, davem, dev, kuba, pshelar, bindiyakurle, fbl
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Wed, 13 Jan 2021 14:50:00 +0100 you wrote:
> 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>
>
> [...]
Here is the summary with links:
- [net-next] net: openvswitch: add log message for error case
https://git.kernel.org/netdev/net-next/c/a5317f3b06b3
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-15 0:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 13:50 [PATCH net-next] net: openvswitch: add log message for error case Eelco Chaudron
2021-01-13 14:29 ` Flavio Leitner
2021-01-15 0:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).