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

-matt




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;

Reply via email to