[Olsr-dev] mtu problem with multicast ipv6 packets
Roar Bjørgum Rotvik
(spam-protected)
Tue Mar 24 15:03:41 CET 2009
Henning Rogge wrote:
[...]
>> You know that Freifunk was considered for GSoC and one of the projects
>> is porting the OBAMP protocol (Overlay Multicast for MANET) from Java
>> to C and make an olsr plugin out of it ??
> No, I did not know about it.
>
> I'm looking (at the moment) for ways to let the kernel do our multicast
> traffic forwarding, instead of doing it in userspace. Maybe I will just
> discover "it cannot be done for mesh networks". ^^
Just wanted you to know that I have written a simple multicast forwarding program for
Linux, that uses the kernel multicast routing tables. The application takes a list of
interfaces and forward each incoming multicast packet to all other interfaces except for
the incoming interface. This behavior is simple to change in the codebase.
Basically your user space program have to do these steps to make the kernel route
multicast between two or more interfaces:
1: Open an IGMP socket and tell the kernel that your application is responsible for
populating the kernel multicast forwarding cache (MFC). This is done with the setsockopt
(MRT_INIT). Only one application at a time can hold this "flag" and one application must
be running with this "flag" set for MFC to work.
2: Add your interfaces that will participate in mcast forwarding (these interfaces is
called VIF - Virtual InterFace). See setsockopt (MRT_ADD_VIF).
3: Wait for events (poll()/select()) from IGMP socket in point 1, and read out packet as
"struct iphdr".
if iphdr->protocol == 0, then parse received packet as "struct igmpmsg", this header
contains info like incoming VIF and src/dst for mcast packet.
After "struct igmpmsg" follows an "struct igmphdr" header with member im_msgtype.
If this member is 1 then the multicast packet was not found in the kernel MFC table and is
passed to your application so that it can be handled.
Most likely you would want to add an MFC entry based on this packet, so other packet with
same src/dst is forwarded by the kernel.
4: Add an MFC entry, to make kernel forward mcast packets to a given interface (or more
interfaces).
Use "struct mfcctl" here. Fill out with source IP, mcast destination, incoming VIF and an
array of outgoing VIF's (enable those VIF indexes in this array that matches the wanted
outgoing interfaces). Set MFC with setsockopt (MRT_ADD_MFC).
This is the basic routine just to enable kernel mcast forwarding, and populate the forward
cache from an user space application.
Was it information like this you wanted? (I saw your message on the linux-net/netdev
mailing list) :)
--
Roar Bjørgum Rotvik
More information about the Olsr-dev
mailing list