All of lore.kernel.org
 help / color / mirror / Atom feed
* SO_REUSEPORT and multicasting
@ 2006-06-13 19:24 Jason
  2006-06-13 20:20 ` Jan Engelhardt
  2006-06-14 14:40 ` James Courtier-Dutton
  0 siblings, 2 replies; 13+ messages in thread
From: Jason @ 2006-06-13 19:24 UTC (permalink / raw)
  To: linux-kernel

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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-13 19:24 SO_REUSEPORT and multicasting Jason
@ 2006-06-13 20:20 ` Jan Engelhardt
  2006-06-14 14:26   ` Jason
  2006-06-14 14:40 ` James Courtier-Dutton
  1 sibling, 1 reply; 13+ messages in thread
From: Jan Engelhardt @ 2006-06-13 20:20 UTC (permalink / raw)
  To: Jason; +Cc: linux-kernel

>
>Does the kernel support SO_REUSEPORT?

IIRC no, *BSD being the only one(s) I know of.

> 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
-- 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-13 20:20 ` Jan Engelhardt
@ 2006-06-14 14:26   ` Jason
  2006-06-14 14:51     ` Alan Cox
  0 siblings, 1 reply; 13+ messages in thread
From: Jason @ 2006-06-14 14:26 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: linux-kernel

--- Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:
> >Does the kernel support SO_REUSEPORT?
> 
> IIRC no, *BSD being the only one(s) I know of.
> 
> > 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?

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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-13 19:24 SO_REUSEPORT and multicasting Jason
  2006-06-13 20:20 ` Jan Engelhardt
@ 2006-06-14 14:40 ` James Courtier-Dutton
  2006-06-14 18:04   ` Jason
  1 sibling, 1 reply; 13+ messages in thread
From: James Courtier-Dutton @ 2006-06-14 14:40 UTC (permalink / raw)
  To: Jason; +Cc: linux-kernel

Jason wrote:
> 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
>
>   
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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-14 14:26   ` Jason
@ 2006-06-14 14:51     ` Alan Cox
  2006-06-14 17:48       ` Jason
  0 siblings, 1 reply; 13+ messages in thread
From: Alan Cox @ 2006-06-14 14:51 UTC (permalink / raw)
  To: Jason; +Cc: Jan Engelhardt, linux-kernel

Ar Mer, 2006-06-14 am 07:26 -0700, ysgrifennodd Jason:
> > 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.

> 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.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-14 14:51     ` Alan Cox
@ 2006-06-14 17:48       ` Jason
  2006-06-14 22:14         ` David Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Jason @ 2006-06-14 17:48 UTC (permalink / raw)
  To: Alan Cox; +Cc: Jan Engelhardt, linux-kernel

--- Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> Linux follows the standards draft.  SO_REUSEPORT is
> 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?

> > 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.

> 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.

> The default IP_MULTICAST_LOOP value 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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-14 14:40 ` James Courtier-Dutton
@ 2006-06-14 18:04   ` Jason
  0 siblings, 0 replies; 13+ messages in thread
From: Jason @ 2006-06-14 18:04 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: linux-kernel

--- James Courtier-Dutton <James@superbug.co.uk>
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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-14 17:48       ` Jason
@ 2006-06-14 22:14         ` David Miller
  2006-06-14 22:57           ` Jason
  0 siblings, 1 reply; 13+ messages in thread
From: David Miller @ 2006-06-14 22:14 UTC (permalink / raw)
  To: bofh1234567; +Cc: alan, jengelh, linux-kernel


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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-14 22:14         ` David Miller
@ 2006-06-14 22:57           ` Jason
  2006-06-14 23:04             ` David Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Jason @ 2006-06-14 22:57 UTC (permalink / raw)
  To: David Miller; +Cc: alan, jengelh, linux-kernel

--- David Miller <davem@davemloft.net> wrote:
> 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.


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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-14 22:57           ` Jason
@ 2006-06-14 23:04             ` David Miller
  2006-06-15 13:32               ` Jason
  0 siblings, 1 reply; 13+ messages in thread
From: David Miller @ 2006-06-14 23:04 UTC (permalink / raw)
  To: bofh1234567; +Cc: alan, jengelh, linux-kernel

From: Jason <bofh1234567@yahoo.com>
Date: Wed, 14 Jun 2006 15:57:01 -0700 (PDT)

> 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.  

We do have a mailing list where the networking developers
actually hang out, netdev@vger.kernel.org

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* SO_REUSEPORT and multicasting
@ 2006-06-15 13:31 Jason
  2006-06-15 22:29 ` David Stevens
  0 siblings, 1 reply; 13+ messages in thread
From: Jason @ 2006-06-15 13:31 UTC (permalink / raw)
  To: netdev

Hello,

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.

I have found out since I posted this message to
linux-kernel that SO_REUSEPORT is a BSDism.  The Linux
equivalent is SO_REUSEADDR which I did try.  My
program compiles cleanly using SO_REUSEADDR, but the
server does not receive any messages.  

I am trying to run the client and server on the same
PC.  This is just for faster development.  I can code
faster on my home Linux system than I can on the
remote HP-UX system.

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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-14 23:04             ` David Miller
@ 2006-06-15 13:32               ` Jason
  0 siblings, 0 replies; 13+ messages in thread
From: Jason @ 2006-06-15 13:32 UTC (permalink / raw)
  To: David Miller; +Cc: alan, jengelh, linux-kernel

--- David Miller <davem@davemloft.net> wrote:

> We do have a mailing list where the networking
> developers
> actually hang out, netdev@vger.kernel.org
> 
> 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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: SO_REUSEPORT and multicasting
  2006-06-15 13:31 Jason
@ 2006-06-15 22:29 ` David Stevens
  0 siblings, 0 replies; 13+ messages in thread
From: David Stevens @ 2006-06-15 22:29 UTC (permalink / raw)
  To: Jason; +Cc: netdev

If you can send me (or post) the program, I may be able to help.

                                +-DLS


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-06-15 22:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-13 19:24 SO_REUSEPORT and multicasting Jason
2006-06-13 20:20 ` Jan Engelhardt
2006-06-14 14:26   ` Jason
2006-06-14 14:51     ` Alan Cox
2006-06-14 17:48       ` Jason
2006-06-14 22:14         ` David Miller
2006-06-14 22:57           ` Jason
2006-06-14 23:04             ` David Miller
2006-06-15 13:32               ` Jason
2006-06-14 14:40 ` James Courtier-Dutton
2006-06-14 18:04   ` Jason
  -- strict thread matches above, loose matches on Subject: below --
2006-06-15 13:31 Jason
2006-06-15 22:29 ` David Stevens

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.