Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jul 2001 13:22:13 -0700 (PDT)
From:      Matthew Jacob <mjacob@feral.com>
To:        Ruslan Ermilov <ru@FreeBSD.ORG>
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:  <20010719131319.I50024-200000@wonky.feral.com>
In-Reply-To: <20010719225006.A77926@sunbay.com>

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

[-- Attachment #1 --]

Had to make a minor change to make sure isbroadcast was set, but yes, that
worked, thank you!

-matt





[-- Attachment #2 --]
Index: ip_output.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_output.c,v
retrieving revision 1.130
diff -u -r1.130 ip_output.c
--- ip_output.c	2001/07/19 07:10:30	1.130
+++ ip_output.c	2001/07/19 20:14:09
@@ -253,14 +253,14 @@
 		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);
+		isbroadcast = 0;
 	} else {
 		/*
 		 * If this is the case, we probably don't want to allocate
@@ -303,8 +303,6 @@
 		 */
 		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 +323,9 @@
 		 * 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 +818,7 @@
 		}
 
 		/* 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 +958,7 @@
 		/* 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;

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