Skip to content

Commit

Permalink
flow_dissector: Ignore flow dissector return value from ___skb_get_hash
Browse files Browse the repository at this point in the history
In ___skb_get_hash ignore return value from skb_flow_dissect_flow_keys.
A failure in that function likely means that there was a parse error,
so we may as well use whatever fields were found before the error was
hit.  This is also good because it means we won't keep trying to derive
the hash on subsequent calls to skb_get_hash for the same packet.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tom Herbert authored and David S. Miller committed Sep 1, 2015
1 parent 823b969 commit 6db61d7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions net/core/flow_dissector.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,8 @@ EXPORT_SYMBOL(flow_hash_from_keys);
static inline u32 ___skb_get_hash(const struct sk_buff *skb,
struct flow_keys *keys, u32 keyval)
{
if (!skb_flow_dissect_flow_keys(skb, keys,
FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL))
return 0;
skb_flow_dissect_flow_keys(skb, keys,
FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL);

return __flow_hash_from_keys(keys, keyval);
}
Expand Down Expand Up @@ -662,15 +661,10 @@ EXPORT_SYMBOL(make_flow_keys_digest);
void __skb_get_hash(struct sk_buff *skb)
{
struct flow_keys keys;
u32 hash;

__flow_hash_secret_init();

hash = ___skb_get_hash(skb, &keys, hashrnd);
if (!hash)
return;

__skb_set_sw_hash(skb, hash,
__skb_set_sw_hash(skb, ___skb_get_hash(skb, &keys, hashrnd),
flow_keys_have_l4(&keys));
}
EXPORT_SYMBOL(__skb_get_hash);
Expand Down

0 comments on commit 6db61d7

Please sign in to comment.