开发者

Packet forwarding

开发者 https://www.devze.com 2023-03-14 00:51 出处:网络
I want to make a program to receive a packet on one network interface do some processing and forward it to a different开发者_运维知识库 interface. What can be the most efficient way to do it on Linux?

I want to make a program to receive a packet on one network interface do some processing and forward it to a different开发者_运维知识库 interface. What can be the most efficient way to do it on Linux? I want to forward the packet with minimum delay


Use libnetfilter_queue.

iptables <....> -j NFQUEUE --queue-num <queue number>

Then write your own program and link with libnetfilter_queue. After some really simple operations you will be able to use recv to receive packets and nfq_set_verdict to decide what to do with the packet.

0

精彩评论

暂无评论...
验证码 换一张
取 消