]> www.infradead.org Git - users/jedix/linux-maple.git/commit
trace: tcp: fully support trace_tcp_send_reset
authorJason Xing <kernelxing@tencent.com>
Mon, 1 Apr 2024 07:36:05 +0000 (15:36 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Apr 2024 02:26:14 +0000 (19:26 -0700)
commit19822a980e1956a6572998887a7df5a0607a32f6
treeff2abee2b5fd4ec8a9c22967bb598596555c6266
parent9807080e2170a9e5a7428d0a0e8d082585b6451f
trace: tcp: fully support trace_tcp_send_reset

Prior to this patch, what we can see by enabling trace_tcp_send is
only happening under two circumstances:
1) active rst mode
2) non-active rst mode and based on the full socket

That means the inconsistency occurs if we use tcpdump and trace
simultaneously to see how rst happens.

It's necessary that we should take into other cases into considerations,
say:
1) time-wait socket
2) no socket
...

By parsing the incoming skb and reversing its 4-tuple can
we know the exact 'flow' which might not exist.

Samples after applied this patch:
1. tcp_send_reset: skbaddr=XXX skaddr=XXX src=ip:port dest=ip:port
state=TCP_ESTABLISHED
2. tcp_send_reset: skbaddr=000...000 skaddr=XXX src=ip:port dest=ip:port
state=UNKNOWN
Note:
1) UNKNOWN means we cannot extract the right information from skb.
2) skbaddr/skaddr could be 0

Signed-off-by: Jason Xing <kernelxing@tencent.com>
Link: https://lore.kernel.org/r/20240401073605.37335-3-kerneljasonxing@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/trace/events/tcp.h
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c