Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jul 2001 22:50:06 +0300
From:      Ruslan Ermilov <ru@FreeBSD.ORG>
To:        Matthew Jacob <mjacob@feral.com>
Cc:        current@FreeBSD.ORG, "Daniel C. Sobral" <dcs@FreeBSD.ORG>
Subject:   Re: did somebody notice a crash in ip_output if you're using multicast?
Message-ID:  <20010719225006.A77926@sunbay.com>
In-Reply-To: <20010719123949.H50024-100000@wonky.feral.com>; from mjacob@feral.com on Thu, Jul 19, 2001 at 12:40:11PM -0700
References:  <20010719123949.H50024-100000@wonky.feral.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--5mCyUwZo2JvN/JJP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Could you please try the attached patch and see if it helps?

On Thu, Jul 19, 2001 at 12:40:11PM -0700, Matthew Jacob wrote:
> 
> fatal kernel trap:
> 
>     trap entry     = 0x2 (memory management fault)
>     cpuid          = 0
>     faulting va    = 0x48
>     type           = access violation
>     cause          = load instructon
>     pc             = 0xfffffc00004ce89c
>     ra             = 0xfffffc00004ce874
>     sp             = 0xfffffe002e1bbaf8
>     usp            = 0x11ffb5a0
>     curproc        = 0xfffffe0028293fc0
>         pid = 199, comm = ntpd
> 
> Stopped at      ip_output+0x9bc:        ldq     t0,0x48(s6) <0x48>
> <t0=0x20
> 100001d00,s6=0x0>
> db> t
> ip_output() at ip_output+0x9bc
> igmp_sendpkt() at igmp_sendpkt+0x1a0
> igmp_joingroup() at igmp_joingroup+0x7c
> in_addmulti() at in_addmulti+0x108
> ip_setmoptions() at ip_setmoptions+0x4c0
> ip_ctloutput() at ip_ctloutput+0x2ac
> sosetopt() at sosetopt+0x4c
> setsockopt() at setsockopt+0xb4
> syscall() at syscall+0x728
> XentSys() at XentSys+0x64
> --- syscall (105, FreeBSD ELF, setsockopt) ---
> --- user mode ---
> db> reboot
> 
> halted CPU 0
> 
> halt code = 5
> HALT instruction executed
> PC = fffffc00005cdf40
> 
> CPU 0 booting
> 
> (boot dkb200.2.0.5.1 -flags a)
> pblock 0 of dkb200.2.0.5.1 is a valid boot block
> reading 15 blocks from dkb200.2.0.5.1
> bootstrap code read in
> base = 200000, image_start = 0, image_bytes = 1e00
> initializing HWRPB at 2000
> 
> -matt
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message

-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

--5mCyUwZo2JvN/JJP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p

Index: ip_output.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_output.c,v
retrieving revision 1.130
diff -u -p -r1.130 ip_output.c
--- ip_output.c	2001/07/19 07:10:30	1.130
+++ ip_output.c	2001/07/19 10:49:09
@@ -253,14 +253,13 @@ ip_output(m0, opt, ro, flags, imo)
 		ip->ip_ttl = 1;
 		isbroadcast = in_broadcast(dst->sin_addr, ifp);
 	} else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&
-	    (imo != NULL) &&
-	    (imo->imo_multicast_ifp != NULL)) {
+	    imo != NULL && imo->imo_multicast_ifp != NULL) {
 		/*
-		 * bypass the normal routing lookup for
-		 * multicast packets if the interface is
-		 * specified
+		 * Bypass the normal routing lookup for multicast
+		 * packets if the interface is specified.
 		 */
-		/* No Operation */
+		ifp = imo->imo_multicast_ifp;
+		IFP_TO_IA(ifp, ia);
 	} else {
 		/*
 		 * If this is the case, we probably don't want to allocate
@@ -303,8 +302,6 @@ ip_output(m0, opt, ro, flags, imo)
 		 */
 		if (imo != NULL) {
 			ip->ip_ttl = imo->imo_multicast_ttl;
-			if (imo->imo_multicast_ifp != NULL)
-				ifp = imo->imo_multicast_ifp;
 			if (imo->imo_multicast_vif != -1)
 				ip->ip_src.s_addr =
 				    ip_mcast_src(imo->imo_multicast_vif);
@@ -325,13 +322,9 @@ ip_output(m0, opt, ro, flags, imo)
 		 * of outgoing interface.
 		 */
 		if (ip->ip_src.s_addr == INADDR_ANY) {
-			register struct in_ifaddr *ia1;
-
-			TAILQ_FOREACH(ia1, &in_ifaddrhead, ia_link)
-				if (ia1->ia_ifp == ifp) {
-					ip->ip_src = IA_SIN(ia1)->sin_addr;
-					break;
-				}
+			/* XXX: interface may have no addresses. */
+			if (ia != NULL)
+				ip->ip_src = IA_SIN(ia)->sin_addr;
 		}
 
 		IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm);
@@ -824,7 +817,7 @@ pass:
 		}
 
 		/* Record statistics for this interface address. */
-		if (!(flags & IP_FORWARDING)) {
+		if (!(flags & IP_FORWARDING) && ia) {
 			ia->ia_ifa.if_opackets++;
 			ia->ia_ifa.if_obytes += m->m_pkthdr.len;
 		}
@@ -964,7 +957,7 @@ sendorfree:
 		/* clean ipsec history once it goes out of the node */
 		ipsec_delaux(m);
 #endif
-		if (error == 0) {
+		if (error == 0 && ia) {
 			/* Record statistics for this interface address. */
 			ia->ia_ifa.if_opackets++;
 			ia->ia_ifa.if_obytes += m->m_pkthdr.len;

--5mCyUwZo2JvN/JJP--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010719225006.A77926>