tcp: add a dropreason definitions and prepare for cookie check
authorJason Xing <kernelxing@tencent.com>
Mon, 26 Feb 2024 03:22:18 +0000 (11:22 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Feb 2024 10:39:21 +0000 (10:39 +0000)
Adding one drop reason to detect the condition of skb dropped
because of hook points in cookie check and extending NO_SOCKET
to consider another two cases can be used later.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dropreason-core.h

index 6d3a20163260ad4e84af368eb83441221ea44c65..a871f061558d60e6ee0d0600dbdbe7fa84f94e58 100644 (file)
@@ -54,6 +54,7 @@
        FN(NEIGH_QUEUEFULL)             \
        FN(NEIGH_DEAD)                  \
        FN(TC_EGRESS)                   \
+       FN(SECURITY_HOOK)               \
        FN(QDISC_DROP)                  \
        FN(CPU_BACKLOG)                 \
        FN(XDP)                         \
@@ -105,7 +106,13 @@ enum skb_drop_reason {
        SKB_CONSUMED,
        /** @SKB_DROP_REASON_NOT_SPECIFIED: drop reason is not specified */
        SKB_DROP_REASON_NOT_SPECIFIED,
-       /** @SKB_DROP_REASON_NO_SOCKET: socket not found */
+       /**
+        * @SKB_DROP_REASON_NO_SOCKET: no valid socket that can be used.
+        * Reason could be one of three cases:
+        * 1) no established/listening socket found during lookup process
+        * 2) no valid request socket during 3WHS process
+        * 3) no valid child socket during 3WHS process
+        */
        SKB_DROP_REASON_NO_SOCKET,
        /** @SKB_DROP_REASON_PKT_TOO_SMALL: packet size is too small */
        SKB_DROP_REASON_PKT_TOO_SMALL,
@@ -271,6 +278,8 @@ enum skb_drop_reason {
        SKB_DROP_REASON_NEIGH_DEAD,
        /** @SKB_DROP_REASON_TC_EGRESS: dropped in TC egress HOOK */
        SKB_DROP_REASON_TC_EGRESS,
+       /** @SKB_DROP_REASON_SECURITY_HOOK: dropped due to security HOOK */
+       SKB_DROP_REASON_SECURITY_HOOK,
        /**
         * @SKB_DROP_REASON_QDISC_DROP: dropped by qdisc when packet outputting (
         * failed to enqueue to current qdisc)