OpenCloudOS / nettrace

nettrace is a eBPF-based tool to trace network packet and diagnose network problem.
Other
326 stars 80 forks source link

Does nettrace support ipv6? If not, will ipv6 packet tracking be supported in the future? #18

Closed Jcm22 closed 1 year ago

menglongdong commented 1 year ago

Hello, ipv6 is supported by nettrace for now. However, the kernel function that we trace in IPv6 packet path is not complete. I added some kernel function this time, now ipv6 packet of TCP can be traced in the general code path:

sudo ./src/nettrace -p ipv6 --diag
begin trace...
***************** ffff8882975e14e0 ***************
[773788.831238] [ip6_output          ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831255] [ip6_finish_output   ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831259] [ip6_finish_output2  ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831263] [__dev_queue_xmit    ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831266] [dev_hard_start_xmit ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831271] [enqueue_to_backlog  ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831285] [__netif_receive_skb_core] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831295] [ipv6_rcv            ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831299] [ip6_rcv_core        ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831307] [nf_hook_slow        ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S *ipv6 in chain: NOTICE*
[773788.831315] [tcp_v6_rcv          ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831321] [inet6_lookup_listener] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S *tcp port is not listened*
[773788.831335] [tcp_v6_send_reset   ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S
[773788.831406] [kfree_skb           ] TCP: :::::::0001:60864 -> :::::::0001:9999 seq:3443414921, ack:0, flags:S *packet is dropped by kernel*
---------------- ANALYSIS RESULT ---------------------
[1] WARNING happens in inet6_lookup_listener(tcp-in):
        tcp port is not listened
    fix advice:
        check your target tcp port

[2] ERROR happens in kfree_skb(life):
        packet is dropped by kernel
    location:
        tcp_v6_rcv+0x52

And the more kernel function we trace on IPv6 will be added in the future, as IPv6 is also being used in our product too.