SO_REUSEPORT and multicasting
I wrote a program that uses multicasting to send data.
It works great on HP-UX but does not work on Fedora
Core 5. I emailed the fedora list but they were of little to no help.
Does the kernel support SO_REUSEPORT? If so can anyone give me some suggestions why my program does not work on Linux? I did a route add -net 224.0.0.0/4 dev eth0 but that did not do anything.
Thanks,
Jesse
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Quoted 2 lines
Does the kernel support
SO_REUSEPORT?
IIRC no, *BSD being the only one(s) I know of.
Quoted 5 lines
If so can
anyone give me some suggestions why my program does not work on Linux? I did a route add -net 224.0.0.0/4 dev eth0 but that did not do anything.
Have you bound to a multicast group in your program?
Jan Engelhardt
Quoted 11 lines · --- Jan Engelhardt
Quoted 1 line
Does the kernel support
SO_REUSEPORT?IIRC no, *BSD being the only one(s) I know of.
Quoted 3 lines
If so can
anyone give me some suggestions why my program does not work on Linux? I did a route add -net224.0.0.0/4
Quoted 2 lines
dev eth0 but that did not do anything.
Have you bound to a multicast group in your program?
If BSD supports it why can't Linux?
Yes. My code works great on HP-UX but does nothing on Linux. It will not compile because it can't find SO_REUSEPORT. I don't have the exact error message at hand, but I could send it if it would help. If I switch to SO_REUSEADDR the code compiles but the server does not receive anything.
Thanks,
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Ar Mer, 2006-06-14 am 07:26 -0700, ysgrifennodd Jason:
Quoted 3 lines
Quoted 1 line
Have you bound to a multicast group in your program?
If BSD supports it why can't Linux?
Linux follows the standards draft. SO_REUSEPORT is fairly obscure BSDism.
Quoted 2 lines
Yes. My code works great on HP-UX but does nothing on Linux.
That doesn't actually prove very much. Its very easy to write incorrect code that only works on one system, especially when endian-ness gets involved with network code.
In particular if writing portable code you must remember to join the group. You must also remember that the various htons/htonl macros need to be correctly used or your code will break on little-endian systems.
The default IP_MULTICAST_LOOP value is probably also worth overriding if you are being fairly paranoid.
Quoted 2 lines · --- Alan Cox
Linux follows the standards draft.
SO_REUSEPORTis a fairly obscure BSDism.
Standards are good. I like standards. I was not aware that SO_REUSEPORT was that obscure. My programming instructor made it sound like every OS supports it. I guess he was wrong. Is there a Linux equivalent to SO_REUSEPORT?
Quoted 8 lines
Quoted 2 lines
Yes. My code works great on HP-UX but does
nothing on Linux.That doesn't actually prove very much. Its very easy to write incorrect
code that only works on one system, especially when endian-ness gets
involved with network code.
I have written other unicast programs on Linux and sftp'd them to HP-UX, compiled, and they ran great. The only change I have to make between Linux and HP-UX is in the Makefile. I have change the following line:
INCS= -I. -include /usr/include/errno.h #to use fedora
I comment out the -include on the HP-UX and everything is great.
This multicast application was based on its TCP brother. The only difference is removing TCP and installing multicast support.
Quoted 6 lines
In particular if writing portable code you must remember to join the
group. You must also remember that the various htons/htonl macros need
to be correctly used or your code will break on little-endian systems.
All of those macros are used in the multicast.c file I was given.
Quoted 3 lines
The default
IP_MULTICAST_LOOPvalue is probably also worth overriding if
you are being fairly paranoid.
The wrapper I used has a function to set the TTL and the loop values. I set the TTL to 3 and the loop to 0.
Thanks,
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Instead of degenerating this mailing list into a BSD socket programming class, you may find this informative:
http://www.unixguide.net/network/socketfaq/4.11.shtml
and it's covered extensively in W. Richard Steven's book, TCP/IP Illustrated, Volume 2. It is considered the bible on BSD socket programming.
Particularly telling is the final paragraph from that web page which reads:
Basically SO_REUSEPORT is a BSD'ism that arose when multicast was added, evne though it was not used in the original Steve Deering code. I believe some BSD-derived systems may also include it. SO_REUSEPORT lets you bind the same address *and* port, but only if all the binders have specified it. But when binding to multicast address (its main use), SO_REUSEADDR is considered identical to SO_REUSEPORT (p. 731, "TCP/IP Illustrated, Volume 2"). So for portability of multicast applications, I always use SO_REUSEADDR.
I STRONGLY suggest you go read that reference to page 731 in the Steven book.
Quoted 6 lines · --- David Miller
Instead of degenerating this mailing list into a BSD socket
programming class, you may find this informative:
http://www.unixguide.net/network/socketfaq/4.11.shtml
Quoted 30 lines
and it's covered extensively in W. Richard Steven's book, TCP/IP
Illustrated, Volume 2. It is considered the bible on BSD socket
programming.Particularly telling is the final paragraph from
that web page which
reads:Basically
SO_REUSEPORTis a BSD'ism that arose when multicast was added, evne though it was not used in
the
original Steve Deering code. I believe some
BSD-derived
systems may also include it.SO_REUSEPORTlets you
bind
the same address *and* port, but only if all the
binders
have specified it. But when binding to multicast
address
(its main use),SO_REUSEADDRis considered
identical to
SO_REUSEPORT(p. 731, "TCP/IP Illustrated, Volume
2").
So for portability of multicast applications, I
always
useSO_REUSEADDR.
Quoted 3 lines
I STRONGLY suggest you go read that reference to
page 731 in
the Steven book.
I agree that I don't want to start a flamewar or get off topic. However, I did state earlier that I did switch to use SO_REUSEADDR and while the program compiled on Linux (without error) the server did not receive any packets. Hence my questions regarding Linux supporting multicasting.
Thanks,
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
From: Jason <[email protected]>
Date: Wed, 14 Jun 2006 15:57:01 -0700 (PDT)
Quoted 6 lines
I agree that I don't want to start a flamewar or get off topic. However, I did state earlier that I did switch to use
SO_REUSEADDRand while the program compiled on Linux (without error) the server did not receive any packets. Hence my questions regarding Linux supporting multicasting.
We do have a mailing list where the networking developers actually hang out, [email protected]
It seems you're not configuring the multicast route correctly or something like that, the socket stuff should all work just fine because David Stevens at IBM is testing this stuff all the time.
Why don't you move your multicast route setup questions over to the netdev list?
Thanks.
Quoted 9 lines · --- David Miller
We do have a mailing list where the networking
developers
actually hang out, [email protected]Why don't you move your multicast route setup
questions over
to the netdev list?Thanks.
Thank you for the information. I will send my request there.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Quoted 5 lines · Jason
I wrote a program that uses multicasting to send data.
It works great on HP-UX but does not work on Fedora
Core 5. I emailed the fedora list but they were of little to no help.
Quoted 9 lines
Does the kernel support
SO_REUSEPORT? If so can anyone give me some suggestions why my program does not work on Linux? I did a route add -net 224.0.0.0/4 dev eth0 but that did not do anything.Thanks,
Jesse
That address is a multicast address, and therefore needs to go in the multicast routing table, and not the unicast one. You are using a command that only modifies the unicast table.
James
--- James Courtier-Dutton <[email protected]>
Quoted 7 lines · wrote:
That address is a multicast address, and therefore needs to go in the
multicast routing table, and not the unicast one. You are using a command that only modifies the unicast table.James
The broadcasts don't have to leave my PC so I shouldn't need a multicast router, do I? The client is running in one terminal window and the server in a second terminal window.
I checked the router man page and found the following:
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via "eth0". This is the correct normal configuration line with a multicasting kernel.
If there is another command, will you please tell me what it is?
Thanks,
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com