Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet - Make sure that interface can't be marked up be...



details:   https://anonhg.NetBSD.org/src/rev/3e8acd9dca4c
branches:  trunk
changeset: 471536:3e8acd9dca4c
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Apr 04 09:10:27 1999 +0000

description:
- Make sure that interface can't be marked up before a route to the remote
  tunnel end was found.
- Flush route and reset MTU if interface is marked down.

diffstat:

 sys/netinet/ip_ipip.c |  25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diffs (46 lines):

diff -r 132bfd2aa00f -r 3e8acd9dca4c sys/netinet/ip_ipip.c
--- a/sys/netinet/ip_ipip.c     Sun Apr 04 06:57:03 1999 +0000
+++ b/sys/netinet/ip_ipip.c     Sun Apr 04 09:10:27 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_ipip.c,v 1.5 1999/04/04 00:21:53 tron Exp $ */
+/*     $NetBSD: ip_ipip.c,v 1.6 1999/04/04 09:10:27 tron Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -303,6 +303,8 @@
 
                sc->sc_src = (satosin(ifa->ifa_addr))->sin_addr;
                sc->sc_dst = ia->ia_dstaddr.sin_addr;
+               ifp->if_mtu = 0;
+               ifp->if_flags &= ~IFF_UP;
 
                if (!in_nullhost(sc->sc_src) && !in_nullhost(sc->sc_dst)) {
                        struct rtentry *rt;
@@ -324,6 +326,27 @@
        case SIOCSIFFLAGS:
                if (in_nullhost(sc->sc_src) || in_nullhost(sc->sc_dst))
                        ifp->if_flags &= ~IFF_UP;
+
+               if (ifp->if_flags & IFF_UP) {
+                       if (sc->sc_route.ro_rt == NULL) {
+                               struct rtentry *rt;
+
+                               ipip_compute_route(sc);
+                               rt = sc->sc_route.ro_rt;
+                               if (rt != NULL)
+                                       ifp->if_mtu = rt->rt_ifp->if_mtu -
+                                                     ifp->if_hdrlen;
+                               else
+                                       ifp->if_flags &= ~IFF_UP;
+                       }
+               }
+               else {
+                       if (sc->sc_route.ro_rt != NULL) {
+                               RTFREE(sc->sc_route.ro_rt);
+                               sc->sc_route.ro_rt = NULL;
+                       }
+                       ifp->if_mtu = 0;
+               }
                break;
 
        case SIOCSIFMTU:



Home | Main Index | Thread Index | Old Index