summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorJason Xing <kernelxing@tencent.com>2024-04-25 11:13:37 +0800
committerPaolo Abeni <pabeni@redhat.com>2024-04-26 15:34:00 +0200
commit120391ef9ca8fe8f82ea3f2961ad802043468226 (patch)
treeba253590d95949da259a0d2d571178332eeb1df8 /include/net
parent5691276b39daf90294c6a81fb6d62d667f634c92 (diff)
tcp: support rstreason for passive reset
Reuse the dropreason logic to show the exact reason of tcp reset, so we can finally display the corresponding item in enum sk_reset_reason instead of reinventing new reset reasons. This patch replaces all the prior NOT_SPECIFIED reasons. Signed-off-by: Jason Xing <kernelxing@tencent.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/rstreason.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/net/rstreason.h b/include/net/rstreason.h
index bc53b5a24505..df3b6ac0c9b3 100644
--- a/include/net/rstreason.h
+++ b/include/net/rstreason.h
@@ -103,4 +103,19 @@ enum sk_rst_reason {
*/
SK_RST_REASON_MAX,
};
+
+/* Convert skb drop reasons to enum sk_rst_reason type */
+static inline enum sk_rst_reason
+sk_rst_convert_drop_reason(enum skb_drop_reason reason)
+{
+ switch (reason) {
+ case SKB_DROP_REASON_NOT_SPECIFIED:
+ return SK_RST_REASON_NOT_SPECIFIED;
+ case SKB_DROP_REASON_NO_SOCKET:
+ return SK_RST_REASON_NO_SOCKET;
+ default:
+ /* If we don't have our own corresponding reason */
+ return SK_RST_REASON_NOT_SPECIFIED;
+ }
+}
#endif