LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-09-2018, 10:00 PM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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.
 
Old 01-10-2018, 02:25 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
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.
 
Old 01-12-2018, 09:19 PM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
how is the condition expressed? would it be possible to just send ALL UDP to one process (one condition, that it is UDP)?
 
Old 01-16-2018, 03:15 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
Netfilter handles all incoming packet no matter UDP or TCP.
 
Old 01-16-2018, 08:19 PM   #5
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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?
 
Old 01-17-2018, 03:14 PM   #6
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
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/
 
Old 01-17-2018, 09:29 PM   #7
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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.
 
Old 01-18-2018, 02:45 PM   #8
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to receive UDP broadcast from a UDP socket bound to an interface Sreeram B S Linux - Networking 5 05-03-2012 02:44 PM
ssh tunnel with wide range of ports Apollo77 Linux - Networking 4 09-14-2008 03:33 PM
Monitor Range to wide nygeek05 Slackware 9 03-26-2006 12:08 AM
Iptables wide open, but no UDP packets allowed (all ports closed) please help mfeoli Linux - Networking 1 01-06-2006 09:52 AM
How to receive UDP and ICMP packets, by one UDP socket(PMTUD) myself_rajat Linux - Networking 0 05-28-2004 05:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration