• Jason Xing's avatar
    trace: tcp: fully support trace_tcp_send_reset · 19822a98
    Jason Xing authored
    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: default avatarJason Xing <kernelxing@tencent.com>
    Link: https://lore.kernel.org/r/20240401073605.37335-3-kerneljasonxing@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    19822a98
tcp.h 9.83 KB