Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
isno committed Feb 2, 2025
1 parent df25bdc commit c4e649f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion network/XDP.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ DPDK 技术完全绕过内核,直接将数据包透传至用户空间处理。
- **LSM**(Linux Security Modules)钩子:位于 Linux 安全模块框架中,允许在内核执行某些安全相关操作(如文件访问、网络访问等)时触发 eBPF 程序。主要用于实现安全策略和访问控制。例如,可以编写 eBPF 程序来强制执行自定义的安全规则或监控系统的安全事件。
- **XDP** 钩子:位于网络栈最底层的钩子,直接在网卡驱动程序中触发,用于处理收到的网络数据包,主要用于实现超高速的数据包处理操作,例如 DDoS 防护、负载均衡、数据包过滤等。

从上述钩子可见,XDP 本质上是 Linux 内核在网络路径上设置的钩子,位于网卡驱动层,在数据包进入网络协议栈之前。当 XDP 执行完 eBPF 程序后,通过“返回码”来指示数据包的最终处理决定。XDP 支持以下 5 种返回码:
从上述钩子可见,XDP 本质上是 Linux 内核在网络路径上设置的钩子,位于网卡驱动层,在数据包进入网络协议栈之前。当 XDP 执行完 eBPF 程序后,通过“返回码”来指示数据包的最终处理决定。

XDP 的 5 种返回码及其含义如下:

- **XDP_ABORTED**:表示 XDP 程序处理数据包时遇到错误或异常。
- **XDP_DROP**:在网卡驱动层直接将该数据包丢掉,通常用于过滤无效或不需要的数据包,如实现 DDoS 防护时,丢弃恶意数据包。
Expand Down

0 comments on commit c4e649f

Please sign in to comment.