skb: make drop reason booleanable

We have a number of cases where function returns drop/no drop
decision as a boolean. Now that we want to report the reason
code as well we have to pass extra output arguments.

We can make the reason code evaluate correctly as bool.

I believe we're good to reorder the reasons as they are
reported to user space as strings.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski
2022-03-07 16:44:21 -08:00
committed by David S. Miller
parent 1163319993
commit 1330b6ef33
5 changed files with 35 additions and 31 deletions

View File

@@ -1965,9 +1965,10 @@ process:
struct sock *nsk;
sk = req->rsk_listener;
if (unlikely(tcp_inbound_md5_hash(sk, skb, &drop_reason,
&iph->saddr, &iph->daddr,
AF_INET, dif, sdif))) {
drop_reason = tcp_inbound_md5_hash(sk, skb,
&iph->saddr, &iph->daddr,
AF_INET, dif, sdif);
if (unlikely(drop_reason)) {
sk_drops_add(sk, skb);
reqsk_put(req);
goto discard_it;
@@ -2041,8 +2042,9 @@ process:
goto discard_and_relse;
}
if (tcp_inbound_md5_hash(sk, skb, &drop_reason, &iph->saddr,
&iph->daddr, AF_INET, dif, sdif))
drop_reason = tcp_inbound_md5_hash(sk, skb, &iph->saddr,
&iph->daddr, AF_INET, dif, sdif);
if (drop_reason)
goto discard_and_relse;
nf_reset_ct(skb);