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

@ -1632,8 +1632,10 @@ process:
struct sock *nsk;
sk = req->rsk_listener;
if (tcp_inbound_md5_hash(sk, skb, &drop_reason, &hdr->saddr,
&hdr->daddr, AF_INET6, dif, sdif)) {
drop_reason = tcp_inbound_md5_hash(sk, skb,
&hdr->saddr, &hdr->daddr,
AF_INET6, dif, sdif);
if (drop_reason) {
sk_drops_add(sk, skb);
reqsk_put(req);
goto discard_it;
@ -1704,8 +1706,9 @@ process:
goto discard_and_relse;
}
if (tcp_inbound_md5_hash(sk, skb, &drop_reason, &hdr->saddr,
&hdr->daddr, AF_INET6, dif, sdif))
drop_reason = tcp_inbound_md5_hash(sk, skb, &hdr->saddr, &hdr->daddr,
AF_INET6, dif, sdif);
if (drop_reason)
goto discard_and_relse;
if (tcp_filter(sk, skb)) {