LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   receive UDP on a very wide range of multiple ports (https://www.linuxquestions.org/questions/linux-networking-3/receive-udp-on-a-very-wide-range-of-multiple-ports-4175621319/)

Skaperen 01-09-2018 10:00 PM

receive UDP on a very wide range of multiple ports
 
i have a use for a way for a program to receive datagrams (UDP) on a very wide range of ports, wider than the number of file descriptors a single process could have open. i am wondering if there is some way to bind a single socket to receive datagrams over a specified range of ports, or every port. the process can be initialized with root permissions.

nini09 01-10-2018 02:25 PM

You can add a hook on netfilter. If incoming packet meet condition, it is inserted into a FIFO. In user space, a socket program read the FIFO and process it.

Skaperen 01-12-2018 09:19 PM

how is the condition expressed? would it be possible to just send ALL UDP to one process (one condition, that it is UDP)?

nini09 01-16-2018 03:15 PM

Netfilter handles all incoming packet no matter UDP or TCP.

Skaperen 01-16-2018 08:19 PM

but ... how do you express a netfilter rule to send all UDP packets destined for ports 4000..7999 on this host to be sent to the process running program "foo" or a named socket "foo" or a named fifo "foo"? do you have examples?

nini09 01-17-2018 03:14 PM

Netfilter doesn't like iptable, iptable has rule concept. Netfilter is C code hook.
Here is example, http://heapspray.net/post/writing-a-...r-3xx-kernels/

Skaperen 01-17-2018 09:29 PM

the rules get put in place in the kernel. i am talking about the rule form itself. that would be how the iptables command communicates with the kernel. but for discussion i am only talking about rules conceptually since the real goal is something else. so the input to iptables or the output (to the kernel) from iptables is what i am wanting to know.

nini09 01-18-2018 02:45 PM

Iptable should have some limitation because it is command line. But netfilter is C code hook, no limitation.


All times are GMT -5. The time now is 10:24 PM.