Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/netinet Pull up revision 1.98-1.99 (requested by it...



details:   https://anonhg.NetBSD.org/src/rev/5263e754aa77
branches:  netbsd-1-6
changeset: 529212:5263e754aa77
user:      tron <tron%NetBSD.org@localhost>
date:      Fri Nov 01 12:14:28 2002 +0000

description:
Pull up revision 1.98-1.99 (requested by itojun in ticket #356):
do not consult routing table under the following condition:
- - the destination is IPv4 multicast or 255.255.255.255, and
- - outgoing interface is specified via socket option
this simplifies operation of routed
(no longer require 224.0.0.0/4 to be set up)

diffstat:

 sys/netinet/ip_output.c |  29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diffs (59 lines):

diff -r 3d38de2a6a43 -r 5263e754aa77 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Fri Nov 01 11:55:04 2002 +0000
+++ b/sys/netinet/ip_output.c   Fri Nov 01 12:14:28 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.95.10.1 2002/09/30 13:05:29 lukem Exp $        */
+/*     $NetBSD: ip_output.c,v 1.95.10.2 2002/11/01 12:14:28 tron Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.95.10.1 2002/09/30 13:05:29 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.95.10.2 2002/11/01 12:14:28 tron Exp $");
 
 #include "opt_pfil_hooks.h"
 #include "opt_ipsec.h"
@@ -265,6 +265,12 @@
                ifp = ia->ia_ifp;
                mtu = ifp->if_mtu;
                ip->ip_ttl = 1;
+       } else if ((IN_MULTICAST(ip->ip_dst.s_addr) ||
+           ip->ip_dst.s_addr == INADDR_BROADCAST) &&
+           imo != NULL && imo->imo_multicast_ifp != NULL) {
+               ifp = imo->imo_multicast_ifp;
+               mtu = ifp->if_mtu;
+               IFP_TO_IA(ifp, ia);
        } else {
                if (ro->ro_rt == 0)
                        rtalloc(ro);
@@ -296,14 +302,21 @@
                /*
                 * See if the caller provided any multicast options
                 */
-               if (imo != NULL) {
+               if (imo != NULL)
                        ip->ip_ttl = imo->imo_multicast_ttl;
-                       if (imo->imo_multicast_ifp != NULL) {
-                               ifp = imo->imo_multicast_ifp;
-                               mtu = ifp->if_mtu;
-                       }
-               } else
+               else
                        ip->ip_ttl = IP_DEFAULT_MULTICAST_TTL;
+
+               /*
+                * if we don't know the outgoing ifp yet, we can't generate
+                * output
+                */
+               if (!ifp) {
+                       ipstat.ips_noroute++;
+                       error = ENETUNREACH;
+                       goto bad;
+               }
+
                /*
                 * If the packet is multicast or broadcast, confirm that
                 * the outgoing interface can transmit it.



Home | Main Index | Thread Index | Old Index