有没有我可以用来 disable/unload/ 或停止 linux 中的 tcp/IP 堆栈的选项或命令?需要它在服务器应用程序中实现用户 space tcp
Is there an option or command that I can used to disable/unload/ or stop the tcp/IP stack in linux. Need it to implement user space tcp in server app
我正在编写一个 C 程序,该程序使用 sockets
在我正在处理的服务器应用程序中实现 tcp 网络。我想知道是否可以禁用内核的 tcp/ip 堆栈,这样我的系统就不会干扰传入的连接同步请求和 IP 数据包。
或者我必须编译内核来禁用它,如果是这种情况请告诉我。
关于这个问题How to create a custom packet in c?
它说
Also note that if you are trying to send raw tcp/udp packets, one problem you will have is disabling the network stack automatically processing the reply (either by treating it as addressed to an existing IP address or attempting to forward it).
既然如此,那怎么可能。
或者 Linux 中是否有任何工具或程序可用于实现此评论 Disable TCP/IP Stack from user-space
There is of course the counterintuitive approach of using additional networking functionality to disable normal networking functionality: netfilter. There are a few iptables matches/targets which might prove beneficial to you (e.g., the “owner” match that may deny or accept based on PID or UID). This still means the functionality is in the kernel, it just limits it.
如果有人从右上角知道那么怎么办有没有命令?
好吧,你可以在没有网络的情况下自己编译一个内核:)
几个选项
- 查看 DPDK 项目 (https://www.linuxjournal.com/content/userspace-networking-dpdk)。 DPDK 通过 UIO 驱动程序
igb_uio|uio_pci_generic|vfio-pci
将物理 NIC 传递给用户 space。因此消除了内核堆栈。
- 将支持 XDP 的 NIC 与零拷贝或驱动程序模式结合使用。使用 eBPF 运行 可以绕过内核堆栈将接收到的数据包直接推送给用户 space。
除非这是一个家庭作业项目,否则请记住:不要发明,要重复使用。
[根据评论进行编辑] 用户space TCP-IP 堆栈有自定义 sock-API 到 read/write 到套接字中。因此,无论是 LD_PRELOAD 还是源文件更改,都可以使用相同的应用程序。
我正在编写一个 C 程序,该程序使用 sockets
在我正在处理的服务器应用程序中实现 tcp 网络。我想知道是否可以禁用内核的 tcp/ip 堆栈,这样我的系统就不会干扰传入的连接同步请求和 IP 数据包。
或者我必须编译内核来禁用它,如果是这种情况请告诉我。
关于这个问题How to create a custom packet in c?
它说
Also note that if you are trying to send raw tcp/udp packets, one problem you will have is disabling the network stack automatically processing the reply (either by treating it as addressed to an existing IP address or attempting to forward it).
既然如此,那怎么可能。
或者 Linux 中是否有任何工具或程序可用于实现此评论 Disable TCP/IP Stack from user-space
There is of course the counterintuitive approach of using additional networking functionality to disable normal networking functionality: netfilter. There are a few iptables matches/targets which might prove beneficial to you (e.g., the “owner” match that may deny or accept based on PID or UID). This still means the functionality is in the kernel, it just limits it.
如果有人从右上角知道那么怎么办有没有命令?
好吧,你可以在没有网络的情况下自己编译一个内核:)
几个选项
- 查看 DPDK 项目 (https://www.linuxjournal.com/content/userspace-networking-dpdk)。 DPDK 通过 UIO 驱动程序
igb_uio|uio_pci_generic|vfio-pci
将物理 NIC 传递给用户 space。因此消除了内核堆栈。 - 将支持 XDP 的 NIC 与零拷贝或驱动程序模式结合使用。使用 eBPF 运行 可以绕过内核堆栈将接收到的数据包直接推送给用户 space。
除非这是一个家庭作业项目,否则请记住:不要发明,要重复使用。
[根据评论进行编辑] 用户space TCP-IP 堆栈有自定义 sock-API 到 read/write 到套接字中。因此,无论是 LD_PRELOAD 还是源文件更改,都可以使用相同的应用程序。