Multicast patch (2.0.32)

Juan-Mariano de Goyeneche (jmseyas@selva.dit.upm.es)
Mon, 16 Mar 1998 16:56:49 +0100


Hello!

While using the mrouted we found out that all traffic on the local network
was forwaded properly... except the one generated in the same Linux box
which was running the mrouted....

It seems to us that the problem is ip_build_xmit(), as it does not check
wether the mrouted is launched to give ipmr_forward() a copy.

We have written the following patch, and everything got routed properly.
It has been running a couple of weeks, and no side-effects were noticed.
We wrote it for the 2.0.32, althogh we think the problem exists in all
versions...

Also, from rfc 2236,
Note: in older (i.e., non-standard and now obsolete) versions of
IGMPv2, hosts send Leave Messages to the group being left. A
router SHOULD accept Leave Messages addressed to the group being
left in the interests of backwards compatibility with such hosts.
In all cases, however, hosts MUST send to the ALL-ROUTERS address
to be compliant with this specification.

We were sending them to the group being left. Also corrected.

Hope it is usefull. Regards,

Elena and Juan-Mariano.

--- /usr/src/linux/net/ipv4/ip_output.c.original Mon Mar 2 20:40:41 1998
+++ /usr/src/linux/net/ipv4/ip_output.c Mon Mar 16 15:58:40 1998
@@ -28,6 +28,8 @@
* output firewall rules)
* Elliot Poger : Added support for SO_BINDTODEVICE.
* Juan Jose Ciarlante: sk/skb source address rewriting
+ * Elena Apolinario Fdez de Sousa,:ipmr_forward never received multicast
+ * Juan-Mariano de Goyeneche traffic generated locally.
*/

#include <asm/segment.h>
@@ -996,6 +998,22 @@

if (MULTICAST(daddr) && !(dev->flags&IFF_LOOPBACK))
{
+#ifdef CONFIG_IP_MROUTE
+ /* We need this so that mrouted "hears" packets sent from the
+ same host it is running on... (jmel) */
+ if (mroute_socket&&(iph->protocol!=IPPROTO_IGMP))
+ {
+ if((skb->ip_hdr->daddr&htonl(0xFFFFFF00))!=htonl(0xE0000000))
+ {
+ struct sk_buff* skb2=skb_clone(skb, GFP_ATOMIC);
+ if(skb2)
+ {
+ skb2->free=1;
+ ipmr_forward(skb2, 0);
+ }
+ }
+ }
+#endif
/*
* Loop back any frames. The check for IGMP_ALL_HOSTS is because
* you are always magically a member of this group.

--- /usr/src/linux/net/ipv4/igmp.c.orig Thu Mar 12 12:43:29 1998
+++ /usr/src/linux/net/ipv4/igmp.c Mon Mar 16 16:03:09 1998
@@ -64,6 +64,9 @@
* Alexey Kuznetsov: Wrong group leaving behaviour, backport
* fix from pending 2.1.x patches.
* Alan Cox: Forget to enable FDDI support earlier.
+ * Elena Apolinario Fdez de Sousa,: IGMP Leave Messages must be sent to
+ * Juan-Mariano de Goyeneche the "all routers" group, not the group
+ * group being left.
*/


@@ -424,7 +427,9 @@
extern __inline__ void igmp_group_dropped(struct ip_mc_list *im)
{
del_timer(&im->timer);
- igmp_send_report(im->interface, im->multiaddr, IGMP_HOST_LEAVE_MESSAGE);
+ /* It seems we have to send Leave Messages to 224.0.0.2 and not to
+ the group itself, to remain RFC 2236 compliant... (jmel) */
+ igmp_send_report(im->interface, IGMP_ALL_ROUTER, IGMP_HOST_LEAVE_MESSAGE);
ip_mc_filter_del(im->interface, im->multiaddr);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu