From owner-freebsd-net Wed Jul 11 20: 3:17 2001 Delivered-To: freebsd-net@freebsd.org Received: from newsguy.com (smtp.newsguy.com [209.155.56.71]) by hub.freebsd.org (Postfix) with ESMTP id 0A97F37B406 for ; Wed, 11 Jul 2001 20:03:14 -0700 (PDT) (envelope-from dcs@newsguy.com) Received: from newsguy.com (ppp045-bsace7001.telebrasilia.net.br [200.181.80.45]) by newsguy.com (8.9.1a/8.9.1) with ESMTP id UAA81179 for ; Wed, 11 Jul 2001 20:03:09 -0700 (PDT) Message-ID: <3B4D1432.78232E88@newsguy.com> Date: Thu, 12 Jul 2001 00:06:26 -0300 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.77 [en] (Win98; U) X-Accept-Language: en,pt-BR,pt,en-GB,en-US,ja MIME-Version: 1.0 To: net@freebsd.org Subject: Multicasting and routes Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org It seems there is a problem in our IP stack with regards to multicasting. The symptoms is the inability to send multicast packets on correctly configured sockets in the absence of a default (or, erroneously, multicast address being used) route. From my reading of sys/netinet/ip_output.c, and the message error I get, it seems this problem is caused by the following piece of code if (flags & IP_ROUTETOIF) { ... } else { /* * If this is the case, we probably don't want to allocate * a protocol-cloned route since we didn't get one from the * ULP. This lets TCP do its thing, while not burdening * forwarding or ICMP with the overhead of cloning a route. * Of course, we still want to do any cloning requested by * the link layer, as this is probably required in all cases * for correct operation (as it is for ARP). */ if (ro->ro_rt == 0) rtalloc_ign(ro, RTF_PRCLONING); if (ro->ro_rt == 0) { *** HERE *** ipstat.ips_noroute++; error = EHOSTUNREACH; goto bad; } ia = ifatoia(ro->ro_rt->rt_ifa); ifp = ro->ro_rt->rt_ifp; ro->ro_rt->rt_use++; if (ro->ro_rt->rt_flags & RTF_GATEWAY) dst = (struct sockaddr_in *)ro->ro_rt->rt_gateway; if (ro->ro_rt->rt_flags & RTF_HOST) isbroadcast = (ro->ro_rt->rt_flags & RTF_BROADCAST); else isbroadcast = in_broadcast(dst->sin_addr, ifp); } This is immediately followed by if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { struct in_multi *inm; m->m_flags |= M_MCAST; /* * IP destination address is multicast. Make sure "dst" * still points to the address in "ro". (It may have been * changed to point to a gateway address, above.) */ dst = (struct sockaddr_in *)&ro->ro_dst; (etc) I wonder if IN_MULTICAST test shouldn't be applied while checking for a route. Alas, I wonder if multicast packets shouldn't be marked with IP_ROUTETOIF. Unfortunately, my personal knowledge of this piece of code leaves me just wondering. Comments or suggestions? -- Daniel C. Sobral (8-DCS) dcs@newsguy.com dcs@freebsd.org capo@the.secret.bsdconspiracy.net wow regex humor... I'm a geek To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message