惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
宝玉的分享
宝玉的分享
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Privacy International News Feed
T
Threatpost
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
NISL@THU
NISL@THU
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
Intezer
博客园 - Franky
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
The Hacker News
The Hacker News
K
Kaspersky official blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tailwind CSS Blog
Project Zero
Project Zero
T
Tor Project blog
B
Blog RSS Feed
Recorded Future
Recorded Future
Scott Helme
Scott Helme
美团技术团队
V
V2EX
V
Visual Studio Blog
L
Lohrmann on Cybersecurity
P
Proofpoint News Feed
D
DataBreaches.Net
The Register - Security
The Register - Security
M
MIT News - Artificial intelligence
L
LangChain Blog
Cisco Talos Blog
Cisco Talos Blog
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园_首页
P
Privacy & Cybersecurity Law Blog

博客园 - YZG

zigbee路由(报文实例) Zigbee系列(路由机制) Zigbee系列(end device) Zigbee系列(网络) Zigbee系列(概览) kallsyms , addr to symbol ubuntu apt-xxx 清空DNS缓存 shell loop shell 参数 power sequece grep 文件内容搜索 netif_receive_skb pt_prev why? virtual machine AVR地址空间 altera 与 xilinx fifo 时序的区别 如何在Linux下实现50万并发 Linux tcp socket相关参数设置 对Linux下socket限制的理解
Linux checksum flag in kernel
YZG · 2014-08-22 · via 博客园 - YZG

net_device->feature

| NETIF_F_NO_CSUM: No need to use L4 checksum, it used for loopback device.

| NETIF_F_IP_CSUM:  the device can compute L4 checksum in hardware, but only for TCP and UDP over IPv4.

| NETIF_F_HW_CSUM: the device can compute the L4 checksum in hardware for any protocol.

For receive path:

skb->csum  may hold the L4 checksum(when skb->ip_summed == CHECKSUM_COMPLETE, this filed hold the checksum provided by hardware).

skb->ip_summed: indicate the checksum status.

CHECKSUM_NONE:  the checksum in csum is not valid, this can be due to:

  1. device doesn't provide hardware checksumming.

      2. hardware found the packet is corrupted, in normal case, it should drop this packet and not discard this packet, but the driver may want the kernel to re-check it again,so it set this flag.

   IMPORTANT: if the packet is going to be forwarded, the router should not discard it dure to wrong L4 checksum (a route is not supposed to check L4 checksum). but the receiver need to check it.

     3. the checksum need be recomputed nd reverified.

CHECKSUM_HW: the NIC hs computed the checksum on the L4 header and payload. and has copied it into the skb->csum field. The software needs to add checksum on the pseduo-heder to generate the result checksum.

CHECHSUM_UNNECESSARY: the NIC has computed and verified the checksum. software doesn't need to verify the checksum again.

For TX path: skb->csum: tell hardware to put the checksum at this offset of the packet.

skb->ip_summed, CHECKSUM_NONE: the software has processed the checksum, hardware doesn't need to do anything.

CHECKSUM_HW: software computed the checksum of the pseudo-header. hardware need to adding this checksum to L4 header and payload.

refer:tcp_v4_checksum_init for rx, tcp_v4_send_check for tx in kernel code.