Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Avoid kernel panic if interface is configured be...



details:   https://anonhg.NetBSD.org/src/rev/8974797ee782
branches:  trunk
changeset: 471525:8974797ee782
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Apr 04 00:21:53 1999 +0000

description:
Avoid kernel panic if interface is configured before a route to the
remote of the tunnel can be found.

XXX If you manually mark the interface as "UP" and set the MTU later
XXX sending a packet will still cause a kernel panic.

diffstat:

 sys/netinet/ip_ipip.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r 2e80d3f48202 -r 8974797ee782 sys/netinet/ip_ipip.c
--- a/sys/netinet/ip_ipip.c     Sat Apr 03 23:53:48 1999 +0000
+++ b/sys/netinet/ip_ipip.c     Sun Apr 04 00:21:53 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_ipip.c,v 1.4 1999/04/02 20:39:23 hwr Exp $  */
+/*     $NetBSD: ip_ipip.c,v 1.5 1999/04/04 00:21:53 tron Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -301,18 +301,23 @@
                        break;
                }
 
-                       sc->sc_src = (satosin(ifa->ifa_addr))->sin_addr;
-                       sc->sc_dst = ia->ia_dstaddr.sin_addr;
+               sc->sc_src = (satosin(ifa->ifa_addr))->sin_addr;
+               sc->sc_dst = ia->ia_dstaddr.sin_addr;
 
                if (!in_nullhost(sc->sc_src) && !in_nullhost(sc->sc_dst)) {
+                       struct rtentry *rt;
+
                        ipip_compute_route(sc);
                        /*
                         * Now that we know the route to use, fill in the
                         * MTU.
                         */
-                       ifp->if_mtu = sc->sc_route.ro_rt->rt_ifp->if_mtu -
-                           ifp->if_hdrlen;
-                       ifp->if_flags |= IFF_UP;
+                       rt = sc->sc_route.ro_rt;
+                       if (rt != NULL) {
+                               ifp->if_mtu = rt->rt_ifp->if_mtu -
+                                             ifp->if_hdrlen;
+                               ifp->if_flags |= IFF_UP;
+                       }
                }
                break;
 



Home | Main Index | Thread Index | Old Index