[Vserver] multicast support

From: Luc Dumaine <ldumaine_at_sitiv.fr>
Date: Fri 14 Apr 2006 - 17:09:45 BST
Message-ID: <443FC949.6030101@sitiv.fr>


I wasn't able to use multicast for some application server load
balancer, and it didn't work inside a vserver, despite apparently having
every related capability like NET_ADMIN, NET_RAW, NET_BROADCAST,

I tried to make a simple multicast application work:

udpcast, http://udpcast.linux.lu/

It didn't work either.

First because it attempted to bind to the broadcast address of the
vserver interface, ie:, it failed with: -EADDRNOTAVAIL.

Then because it attempted to bind to a multicast address, which resulted
in the same error. (I saw it when I patched enough to pass the first error.)

I patched the /usr/src/linux/net/ipv4/af_inet.c from 2.6.14-vs2.01.

I think that without the patch in a vserver i'm only allowed to bind to:, the loopback address, vserver own addresses and "v4_bcast"
which seems to always be, whatever value is in

With the patch I can also bind to and multicast addresses.
 And perhaps even more addresses as i don't fully know what
inet_addr_type() returning RTN_BROADCAST implies.

Now udpcast works (receiving and sending data), even if I give no
capabilities at all to the vserver.
I'm wondering if I'm too permissive. Do we need some more checks ? Or
even a new ccapability ?

I'll try the load balancing software as soon as I find the time to
reinstall it.

At least this patch could help people who need multicast where security
isn't that much of a concern.

Regards, Luc.

--- linux- 2006-04-14 15:33:09.000000000 +0200
+++ linux- 2006-04-14 13:59:41.000000000 +0200
@@ -427,6 +427,9 @@
                 sk, sk->sk_nx_info, sk->sk_socket,
+ chk_addr_ret = inet_addr_type(s_addr);
         if (nxi) {
                 __u32 v4_bcast = nxi->v4_bcast;
                 __u32 ipv4root = nxi->ipv4[0];
@@ -441,13 +444,12 @@
                         /* rewrite localhost to ipv4root */
                         s_addr = ipv4root;
                         s_addr1 = ipv4root;
- } else if (s_addr != v4_bcast) {
+ } else if ((chk_addr_ret != RTN_BROADCAST) && (chk_addr_ret != RTN_MULTICAST)) {
                         /* normal address bind */
                         if (!addr_in_nx_info(nxi, s_addr))
                                 return -EADDRNOTAVAIL;
- chk_addr_ret = inet_addr_type(s_addr);
         vxdprintk(VXD_CBIT(net, 3),
                 "inet_bind(%p) %d.%d.%d.%d, %d.%d.%d.%d, %d.%d.%d.%d",

Vserver mailing list
Received on Fri Apr 14 17:10:17 2006

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 14 Apr 2006 - 17:10:22 BST by hypermail 2.1.8