本文介绍了linux内核中UDP包的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Linux内核中找到一个UDP数据包的路径.为此,我想阅读一些文档(我有 this 到目前为止,这是针对 TCP 的),然后在相关的内核函数中有一些 printk 语句来确认.我将通过重新编译内核代码来做到这一点.

I want to find the path of a UDP packet in the Linux kernel. For this, I want to read up on some documentation ( I have this so far, which is for TCP) and then have some printk statements in the relevant kernel functions to confirm that. I will do this by recompiling the kernel code.

这是解决问题的方法吗?您有什么建议/参考吗?

Is this the way to go about it? Do you have any suggestions/references?

推荐答案

Linux 网络堆栈是内核的一大块,您需要花一些时间来研究它.我认为这本书可能会有所帮助(侧重于较旧的内核 2.4 和 2.6,但最新内核 3.x 的逻辑保持不变):

The linux networking stack is a big piece of the kernel and you need to spend some time studying it.I think that this books may help (Focused on older kernels 2.4 and 2.6, but the logic remain the same for the latest kernels 3.x):

了解 Linux 网络内部结构

Linux 网络架构 - 网络协议的设计和实现在 Linux 内核中

您也可以查看此链接:

http://e-university.wisdomjobs.com/linux/chapter-189-277/sending-the-data-from-the-socket-through-udp-and-tcp.html

http://www.linuxfoundation.org/collaborate/workgroups/networking/kernel_flow

http://wiki.openwrt.org/doc/networking/praxis

http://www.ibm.com/developerworks/linux/library/l-linux-networking-stack/?ca=dgr-lnxw01lnxNetStack

http://gicl.cs.drexel.edu/people/sevy/network/Linux_network_stack_walkthrough.html

您还需要浏览内核源代码:

You need also to browse the kernel source :

http://lxr.linux.no/#linux+v3.7.3/

使用此功能开始您的网络子系统之路:ip_rcv收到.然后调用其他函数(ip_rcv_finiship_local_deliverip_local_deliver_finish=> 这个函数负责选择好的传输层)

Begin your road to the network sub-system with this function :ip_rcv which is called when a packet is received.other functions are then called (ip_rcv_finish, ip_local_deliver and ip_local_deliver_finish=> This function is responsible for choosing the good transport layer)

这篇关于linux内核中UDP包的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 03:00
查看更多