This blog post explains how computers running the Linux kernel send packets, as well as how to monitor and tune each component of the networking stack as packets flow from user programs to network hardware. 这篇
这两个函数都会从 kernel/smpboot.c 里调用,作为事件处理循环的一部分。 kernel/smpboot.c 里面的代码首先调用 ksoftirqd_should_run 判断是否有 pending 的软 中断,如果有,就执行 run_ksoftirqd,后者做一些 bookeeping 工作,然后调用 __do_softirq。 4.3 __do_softirq __do_softirq 做的几件事情: 判断哪个 ...
当User Application 向一个 fd 执行 read() / write() 时,就可以和 Kernel Network Stack 读写数据了。 Tap/Tun 网卡驱动程序 Tap/Tun 虚拟网卡在 Kernel 看来就是一个网卡设备,还需要实现相应的网卡驱动才可以集成到 Kernel Network Stack。虚拟网卡驱动程序的实现方式与物理网卡没有区别,依旧是常规的 “探测-...
"IPv4/IPv6: UFO (UDP Fragmentation Offload) Scatter-gather approach: UFO is a feature wherein the Linux kernel network stack will offload the IP fragmentation functionality of large UDP datagram to hardware. This will reduce the overhead of stack in fragmenting the large UDP datagram to MTU s...
cd/usr/src/linux/OPTION=-O2-D__KERNEL__PWD=$(shellpwd)#Detectkernelversiondefault:•makemenuconfig;KERNEL_VERSION=$(shellcat/proc/sys/kernel/osrelease)KERNEL_VERSION_MAJOR:=$(shellecho"$(KERNEL_VERSION)"|awk-F.'{printf("%s.%s\n",$$1,$$2)}')•$(MAKE)-C$(KDIR)SUBDIRS=$(PWD)...
ip_rcv() 函数验证 IP 分组,比如目的地址是否本机地址,校验和是否正确等。若正确,则交给 netfilter 的NF_IP_PRE_ROUTING 钩子(关于netfilter细节可以参考 Hacking the Linux Kernel Network Stack );否则,丢弃。到了 ip_rcv_finish() 函数,数据包就要根据 skb 结构的目的或路由信息各奔东西了。
SCI 层提供了某些机制执行从用户空间到内核的函数调用。正如前面讨论的一样,这个接口依赖于体系结构,甚至在相同的处理器家族内也是如此。SCI 实际上是一个非常有用的函数调用多路复用和多路分解服务。在 ./linux/kernel 中您可以找到 SCI 的实现,并在 ./linux/arch 中找到依赖于体系结构的部分。
(1)分配 skb = alloc_skb(len, GFP_KERNEL) (2)添加 payload (skb_put(skb, user_data_len)) (3)使用 skb->push 添加 protocol header,或者 skb->pull 删除 header 2.2 Linux 网络栈使用的驱动队列 (driver queue) (本章节摘选自Queueing in the Linux Network Stackby Dan Siemon) ...
原名:<<Hacking the Linux Kernel Network Stack>> 翻译,修改: duanjigang <duanjigang1983@126.com> 翻译参考:raodan (raod_at_30san.com) 2003-08-22 第一章简介 本文将描述如何利用Linux网络堆栈的窍门(不一定都是漏洞)来达到一些目的,或者是恶意的,或者是出于其它意图的。文中会就后门通讯对...
Network Interface(网络接口)通常是一个硬件设备,也可能是纯软件实现的,例如:loopback 回环接口。Network Interface 由 Kernel 中的 NIC Controller 网络子系统实现,负责数据包的发送和接收。 Unix 访问 Network Interface 的方法是为其分配一个唯一的名字,例如:ethX。Kernel 和 NIC Controller 之间的通信,通过调用一套...