Looking for IGMP (multicast) server-client solution

2008-09-22 Thread Lev Olshvang


Hi,

I have following issue to solve:

The network have one server which sends multicast streams to several 
multicast groups.


I would like it to stop  streaming if no client is listening, and  start 
streaming again when client is joining multicast group.


I see from sniffing, that clients  indeed  send IGMP join group protocol 
message  , and I wonder how to make linux server to handle this join and 
manage multicast group.


I saw that kernel have provisions to manage multicast groups through 
setsockopt(), but I did not find how to get join/leave group 
notification at user

space.

I know that there are multicast routers , like mrouted and pimd and I am 
trying to configure thema at they moment but I  doubt that I can 
configure only one interface because it contradict routing concept, 
isn't it ?


Thanks ,
Lev

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Looking for IGMP (multicast) server-client solution

2008-09-22 Thread Baruch Even
On Mon, Sep 22, 2008 at 11:38 AM, Lev Olshvang [EMAIL PROTECTED] wrote:


 Hi,

 I have following issue to solve:

 The network have one server which sends multicast streams to several
 multicast groups.

 I would like it to stop  streaming if no client is listening, and  start
 streaming again when client is joining multicast group.


Normally for multicast the server never receives any notification if there
are clients or not. It just sends data and if the clients want it, they ask
for it. To control the server actual sending you need an external protocol
to notify the server that there is a new client and when the client leaves.

If the clients are connected to the server without a router between them,
you could implement a program that listens on the interface for the IGMP
messages and controls the server when to send and when not.

If there is a router between the server and the clients you are out of luck
as the router expects the multicast packets to just be sent constantly to
its interface for it to consider this multicast group active at all. A
router will not send IGMP messages to you!


 I see from sniffing, that clients  indeed  send IGMP join group protocol
 message  , and I wonder how to make linux server to handle this join and
 manage multicast group.


If you send data to the interface the clients will receive it, I'm not sure
what is your problem statement here.


 I saw that kernel have provisions to manage multicast groups through
 setsockopt(), but I did not find how to get join/leave group notification at
 user
 space.

 I know that there are multicast routers , like mrouted and pimd and I am
 trying to configure thema at they moment but I  doubt that I can configure
 only one interface because it contradict routing concept, isn't it ?


mrouted and pimd will monitor for IGMP messages and control the kernel
multicast routing fabric. They will instruct the kernel where to forward
multicast packets, but you only need that if you have multiple interfaces on
your computer or to make a multicast router that sits between your multicast
server and clients.

If the server app is on a machine and the clients are connected to it
directly (as in with a switch or a hub) you don't need mrouted.


 Thanks ,
 Lev


Baruch


Re: Looking for IGMP (multicast) server-client solution

2008-09-22 Thread Lev Olshvang





Hi Baruch,

Thanks for response,
I will put my comments close to your statements, please see below



Thaks,


Baruch Even wrote:

  
  On Mon, Sep 22, 2008 at 11:38 AM, Lev Olshvang [EMAIL PROTECTED]
wrote:
  
  
Hi,

I have following issue to solve:

The network have one server which sends multicast streams to several
multicast groups.

I would like it to stop streaming if no client is listening, and
start streaming again when client is joining multicast group.
  
Normally for multicast the server never receives any notification if
there are clients or not. It just sends data and if the clients want
it, they ask for it. To control the server actual sending you need an
external protocol to notify the server that there is a new client and
when the client leaves.
  
  
  

 As such, I think IGMP serves this matter. IGMP defines host -
router conversation and I see IGMP messages from a host 
 (in my terms client). ( client application use setsockopt(
IP_ADD_MEMBERSHIP) ) .

The server box have as linux kernel + mrouted counting for this groups
and making proper entries in /proc/net/igmp, 
/proc/net/ip_mf_cache ,...

  
  
  
If the clients are connected to the server without a router between
them, you could implement a program that listens on the interface for
the IGMP messages and controls the server when to send and when not.
  
  
  

 Since the kernel have this information - which group are active on
every interface, it is very logically to suppose that kernel may easily
filter out the multicast packets to the non-active group. It seems to
me it should work this way.
But these functionality should be implemented in kernel space ( it is
similar to netfilter,) the question is how to turn it on ?

  
  
  
If there is a router between the server and the clients you are out of
luck as the router expects the multicast packets to just be sent
constantly to its interface for it to consider this multicast group
active at all. A router will not send IGMP messages to you!
  
  
  

I think you wrong here, I see mrouted is taking the responsibility of
querier and periodically ask the interface neighbours to confirm every
registered multicast group relationship.


  
  
  
  
  I see from sniffing, that clients indeed send IGMP join
group protocol message , and I wonder how to make linux server to
handle this join and manage multicast group.
  
If you send data to the interface the clients will receive it, I'm not
sure what is your problem statement here. 
  
  
  

 I do not want to overload LAN in a data nobody is interesting (no
clients running) 

  
  
  
  
I saw that kernel have provisions to manage multicast groups through
setsockopt(), but I did not find how to get join/leave group
notification at user
space.

I know that there are multicast routers , like mrouted and pimd and I
am trying to configure thema at they moment but I doubt that I can
configure only one interface because it contradict routing concept,
isn't it ?
  
mrouted and pimd will monitor for IGMP messages and control the kernel
multicast routing fabric. They will instruct the kernel where to
forward multicast packets, but you only need that if you have multiple
interfaces on your computer or to make a multicast router that sits
between your multicast server and clients.
  
  
  

 I expected them to turn outgoing packet filtering on the base of
active group information kernel has.


  
  
  
If the server app is on a machine and the clients are connected to it
directly (as in with a switch or a hub) you don't need mrouted.
  
  
  Thanks ,
Lev
  
Baruch
  
  
  





=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: Looking for IGMP (multicast) server-client solution

2008-09-22 Thread Baruch Even
On Mon, Sep 22, 2008 at 1:39 PM, Lev Olshvang [EMAIL PROTECTED] wrote:


 Hi Baruch,

 Thanks for response,
 I will put my comments close to your statements, please see below



 Thaks,


 Baruch Even wrote:

 On Mon, Sep 22, 2008 at 11:38 AM, Lev Olshvang [EMAIL PROTECTED] wrote:


 Hi,

 I have following issue to solve:

 The network have one server which sends multicast streams to several
 multicast groups.

 I would like it to stop  streaming if no client is listening, and  start
 streaming again when client is joining multicast group.


 Normally for multicast the server never receives any notification if there
 are clients or not. It just sends data and if the clients want it, they ask
 for it. To control the server actual sending you need an external protocol
 to notify the server that there is a new client and when the client leaves.

As such, I think  IGMP serves this matter.  IGMP defines host - router
 conversation and I see IGMP messages from a host
   (in my terms client).  ( client application use setsockopt(
 IP_ADD_MEMBERSHIP) ) .

 The server box have as linux kernel + mrouted counting for this groups and
 making proper entries in /proc/net/igmp,
 /proc/net/ip_mf_cache ,...


Yes.


 If the clients are connected to the server without a router between them,
 you could implement a program that listens on the interface for the IGMP
 messages and controls the server when to send and when not.

   Since the kernel have this information - which group are active on every
 interface, it is very logically to suppose that kernel may easily filter out
 the multicast packets to the non-active group. It seems to me it should work
 this way.
 But these functionality should be implemented in kernel space ( it is
 similar to netfilter,) the question is how to turn it on ?


It has it but multicast routing doesn't work this way. There is no way to
turn it on simply because there is no such functionality. The multicast
sender will continue to send its data on the output interface regardless of
any routing rules. The routing rules can only add additional interfaces to
send to.



 If there is a router between the server and the clients you are out of luck
 as the router expects the multicast packets to just be sent constantly to
 its interface for it to consider this multicast group active at all. A
 router will not send IGMP messages to you!

 I think you wrong here, I see mrouted is taking the responsibility of
 querier and periodically ask the interface neighbours to confirm every
 registered multicast group relationship.


That's the router-client communication. I meant that the router will not
send the multicast sender an IGMP join request.




 I see from sniffing, that clients  indeed  send IGMP join group protocol
 message  , and I wonder how to make linux server to handle this join and
 manage multicast group.


 If you send data to the interface the clients will receive it, I'm not sure
 what is your problem statement here.

I do not want to overload LAN in  a data nobody is interesting  (no
 clients running)


Then the case is closed. Implement your own protocol on top to notify the
server when to stop transmission.

There is one way you can try but it's likely not to work. If you send your
data to a tun device that has no output or a loopback device it might be
that mrouted will properly forward from it to the external interfaces when
clients show up there but the multicast sender will continue to send and
burn cpu time, you just won't see the output on the network.




I saw that kernel have provisions to manage multicast groups through
setsockopt(), but I did not find how to get join/leave group notification at
user
space.

I know that there are multicast routers , like mrouted and pimd and I am
trying to configure thema at they moment but I  doubt that I can configure
only one interface because it contradict routing concept, isn't it ?


mrouted and pimd will monitor for IGMP messages and control the kernel
multicast routing fabric. They will instruct the kernel where to forward
multicast packets, but you only need that if you have multiple interfaces on
your computer or to make a multicast router that sits between your multicast
server and clients.

   I expected them to turn outgoing packet filtering on the base of active
group information kernel has.
That never happens.

Baruch