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.
|
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.
|
how is the condition expressed? would it be possible to just send ALL UDP to one process (one condition, that it is UDP)?
|
Netfilter handles all incoming packet no matter UDP or TCP.
|
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?
|
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/ |
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.
|
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. |