Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux中如何定位是哪个数据包导致异常 #10

Open
cclinuxer opened this issue Jul 13, 2020 · 0 comments
Open

Linux中如何定位是哪个数据包导致异常 #10

cclinuxer opened this issue Jul 13, 2020 · 0 comments
Assignees
Labels
debug debug Linux Linux kernel network linux network

Comments

@cclinuxer
Copy link
Owner

在网络问题的排查中,我们经常遇到,某个数据包导致异常发生,或者说这个导致异常的数据包是谁发出的,具体的报文格式是怎么样的,这里可以通过在内核中讲整个数据包dump出来,然后用wireshark再来具体分析是哪一个主机发出的数据包导致路由器异常。

1、在内核中dump出异常代码段的数据包

			printk("------fix--me--drop-package--in--dst_outputl\n");
			if (skb)
			{
			             char *buf = skb->data;
			             int len = skb->len;
			             int i;
			             printk("[%s:%d]Packet length = %#4x\n", __FUNCTION__, __LINE__, len);
			             for (i = 0; i < len; i++){
			                     if (i % 16 == 0) printk("%#4.4x", i);
			                     if (i % 2 == 0) printk(" ");
			                     printk("%2.2x", ((unsigned char *)buf)[i]);
			                    if (i % 16 == 15) printk("\n");
			             }
			             printk("\n\n\n\n");
			}
			dump_stack();

2、同时用tcpdump抓取对应接口的数据包,通过在wireshark中搜索包含异常数据包的16进制的数据包。从而匹配出异常数据包。从而做进一步分析。

3、定位异常,并打印调用栈进一步分析。

@cclinuxer cclinuxer self-assigned this Jul 13, 2020
@cclinuxer cclinuxer added debug debug Linux Linux kernel network linux network labels Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug debug Linux Linux kernel network linux network
Projects
None yet
Development

No branches or pull requests

1 participant