summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-03-07 16:44:21 -0800
committerDavid S. Miller <davem@davemloft.net>2022-03-09 11:22:58 +0000
commit1330b6ef3313fcec577d2b020c290dc8b9f11f1a (patch)
treeaa98eca413902a3677b68f4eb215e7893b3714bd /include
parent1163319993f0abf8092d5f18fdff98096f7a3a73 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/skbuff.h1
-rw-r--r--include/net/tcp.h21
2 files changed, 12 insertions, 10 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 34f572271c0c..26538ceb4b01 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -314,6 +314,7 @@ struct sk_buff;
* used to translate the reason to string.
*/
enum skb_drop_reason {
+ SKB_NOT_DROPPED_YET = 0,
SKB_DROP_REASON_NOT_SPECIFIED, /* drop reason is not specified */
SKB_DROP_REASON_NO_SOCKET, /* socket not found */
SKB_DROP_REASON_PKT_TOO_SMALL, /* packet size is too small */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d486d7b6112d..ee8237b58e1d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1674,10 +1674,11 @@ tcp_md5_do_lookup(const struct sock *sk, int l3index,
return NULL;
return __tcp_md5_do_lookup(sk, l3index, addr, family);
}
-bool tcp_inbound_md5_hash(const struct sock *sk, const struct sk_buff *skb,
- enum skb_drop_reason *reason,
- const void *saddr, const void *daddr,
- int family, int dif, int sdif);
+
+enum skb_drop_reason
+tcp_inbound_md5_hash(const struct sock *sk, const struct sk_buff *skb,
+ const void *saddr, const void *daddr,
+ int family, int dif, int sdif);
#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
@@ -1688,13 +1689,13 @@ tcp_md5_do_lookup(const struct sock *sk, int l3index,
{
return NULL;
}
-static inline bool tcp_inbound_md5_hash(const struct sock *sk,
- const struct sk_buff *skb,
- enum skb_drop_reason *reason,
- const void *saddr, const void *daddr,
- int family, int dif, int sdif)
+
+static inline enum skb_drop_reason
+tcp_inbound_md5_hash(const struct sock *sk, const struct sk_buff *skb,
+ const void *saddr, const void *daddr,
+ int family, int dif, int sdif);
{
- return false;
+ return SKB_NOT_DROPPED_YET;
}
#define tcp_twsk_md5_key(twsk) NULL
#endif