Skip to content

Comments

Output TCP flags alongside tuple#466

Merged
brb merged 1 commit intocilium:mainfrom
Asphaltt:feat/output-tcpflags
Jan 22, 2025
Merged

Output TCP flags alongside tuple#466
brb merged 1 commit intocilium:mainfrom
Asphaltt:feat/output-tcpflags

Conversation

@Asphaltt
Copy link
Contributor

@Asphaltt Asphaltt commented Dec 6, 2024

It will be helpful to check receiving a RST packet when fail to run telnet.

# ./pwru --filter-func '.*tcp.*' tcp and host 192.168.241.1 and port 8080
2024/12/06 14:30:17 Attaching kprobes (via kprobe-multi)...
146 / 146 [------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
2024/12/06 14:30:17 Attached (ignored 0)
2024/12/06 14:30:17 Listening for events..
SKB                CPU PROCESS          NETNS      MARK/x        IFACE       PROTO  MTU   LEN   __sk_buff->cb[]                                          TUPLE FUNC
0xffff91e7c90a98e8 6   <empty>:0        4026531840 0            ens33:2      0x0800 1500  74    [0x00000000,0x00000000,0x00000000,0x00000000,0x00000000] 192.168.241.133:32956->192.168.241.1:8080(tcp:SYN) tcp_wfree
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 1500  46    [0x00000000,0x00000000,0x00000014,0x00000006,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp4_gro_receive
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 1500  46    [0x00000000,0x00000000,0x00000014,0x00000006,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_gro_receive
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 1500  40    [0x00000000,0x00000000,0x00000000,0x00000000,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_v4_early_demux
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 65536 20    [0x00000000,0x00000000,0x00000000,0x00000000,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_v4_rcv
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 65536 20    [0x00000000,0x00000000,0x00000000,0x00000000,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_filter
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 65536 20    [0x00000000,0x00000000,0x00000000,0x00000000,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_v4_fill_cb
0xffff91e7cf0a3e00 6   <empty>:0        0          0               0         0x0800 65536 20    [0x00000000,0x04000014,0x80E6EBB0,0x00000000,0x00000002] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_v4_do_rcv
0xffff91e7cf0a3e00 6   <empty>:0        0          0               0         0x0800 65536 20    [0x00000000,0x04000014,0x80E6EBB0,0x00000000,0x00000002] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_rcv_state_process
0xffff91e7cf0a3e00 6   <empty>:0        0          0               0         0x0800 65536 20    [0x00000000,0x04000014,0x80E6EBB0,0x00000000,0x00000002] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_rcv_synsent_state_process
0xffff91e7cf0a3e00 6   <empty>:0        0          0               0         0x0800 65536 20    [0x00000000,0x04000014,0x80E6EBB0,0x00000000,0x00000002] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_reset
^C2024/12/06 14:30:22 Received signal, exiting program..
2024/12/06 14:30:22 Detaching kprobes...
4 / 4 [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 22 p/s

@Asphaltt Asphaltt requested a review from a team as a code owner December 6, 2024 14:35
@Asphaltt Asphaltt requested review from brb and removed request for a team December 6, 2024 14:35
@Asphaltt Asphaltt force-pushed the feat/output-tcpflags branch from 84e15d5 to c14460f Compare December 6, 2024 14:55
Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, thanks! We are running out of screen space in the default output, maybe you could enable printing the tcp flags with --output-tcp-flags?

It will be helpful to check receiving a RST packet when fail to run
`telnet`.

```bash
$ sudo ./pwru --output-tcp-flags --filter-func '.*tcp.*' tcp and host 192.168.241.1 and port 8080
2024/12/06 14:30:17 Attaching kprobes (via kprobe-multi)...
146 / 146 [------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s
2024/12/06 14:30:17 Attached (ignored 0)
2024/12/06 14:30:17 Listening for events..
SKB                CPU PROCESS          NETNS      MARK/x        IFACE       PROTO  MTU   LEN   __sk_buff->cb[]                                          TUPLE FUNC
0xffff91e7c90a98e8 6   <empty>:0        4026531840 0            ens33:2      0x0800 1500  74    [0x00000000,0x00000000,0x00000000,0x00000000,0x00000000] 192.168.241.133:32956->192.168.241.1:8080(tcp:SYN) tcp_wfree
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 1500  46    [0x00000000,0x00000000,0x00000014,0x00000006,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp4_gro_receive
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 1500  46    [0x00000000,0x00000000,0x00000014,0x00000006,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_gro_receive
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 1500  40    [0x00000000,0x00000000,0x00000000,0x00000000,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_v4_early_demux
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 65536 20    [0x00000000,0x00000000,0x00000000,0x00000000,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_v4_rcv
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 65536 20    [0x00000000,0x00000000,0x00000000,0x00000000,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_filter
0xffff91e7cf0a3e00 6   <empty>:0        4026531840 0            ens33:2      0x0800 65536 20    [0x00000000,0x00000000,0x00000000,0x00000000,0x00060001] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_v4_fill_cb
0xffff91e7cf0a3e00 6   <empty>:0        0          0               0         0x0800 65536 20    [0x00000000,0x04000014,0x80E6EBB0,0x00000000,0x00000002] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_v4_do_rcv
0xffff91e7cf0a3e00 6   <empty>:0        0          0               0         0x0800 65536 20    [0x00000000,0x04000014,0x80E6EBB0,0x00000000,0x00000002] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_rcv_state_process
0xffff91e7cf0a3e00 6   <empty>:0        0          0               0         0x0800 65536 20    [0x00000000,0x04000014,0x80E6EBB0,0x00000000,0x00000002] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_rcv_synsent_state_process
0xffff91e7cf0a3e00 6   <empty>:0        0          0               0         0x0800 65536 20    [0x00000000,0x04000014,0x80E6EBB0,0x00000000,0x00000002] 192.168.241.1:8080->192.168.241.133:32956(tcp:RST|ACK) tcp_reset
^C2024/12/06 14:30:22 Received signal, exiting program..
2024/12/06 14:30:22 Detaching kprobes...
4 / 4 [---------------------------------------------------------------------------------------------------------------------------------------] 100.00% 22 p/s
```

Signed-off-by: Leon Hwang <[email protected]>
@Asphaltt Asphaltt force-pushed the feat/output-tcpflags branch from c14460f to e5c7181 Compare January 15, 2025 13:55
@Asphaltt Asphaltt requested a review from brb January 15, 2025 13:56
@jschwinger233
Copy link
Member

Agree with --output-tcp-flags, also raise my concern about " running out of screen space" 😿

Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@brb brb merged commit 619e931 into cilium:main Jan 22, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants