must not do ginode() on numbers less than ROOTINO
[unix-history] / usr / src / sbin / routed / startup.c
index 8ef1b94..51503b1 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)startup.c  4.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)startup.c  4.8 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -9,6 +9,7 @@ static char sccsid[] = "@(#)startup.c   4.5 (Berkeley) %G%";
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <nlist.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <nlist.h>
+#include <syslog.h>
 
 struct interface *ifnet;
 int    kmem = -1;
 
 struct interface *ifnet;
 int    kmem = -1;
@@ -43,7 +44,7 @@ ifinit()
                        goto bad;
                }
                performnlist = 0;
                        goto bad;
                }
                performnlist = 0;
-               if (gateway)
+               if (gateway > 0)
                        rtdefault();
        }
        if (kmem < 0) {
                        rtdefault();
        }
        if (kmem < 0) {
@@ -151,10 +152,14 @@ addrouteforif(ifp)
                dst = (struct sockaddr *)&net;
        }
        rt = rtlookup(dst);
                dst = (struct sockaddr *)&net;
        }
        rt = rtlookup(dst);
-       rtadd(dst, &ifp->int_addr, ifp->int_metric,
-               ifp->int_flags & (IFF_INTERFACE|IFF_PASSIVE|IFF_REMOTE));
+       if (rt && equal(&ifp->int_addr, &rt->rt_router))
+               return;
+       if (ifp->int_transitions++ > 0)
+               syslog(LOG_ERR, "re-installing interface %s", ifp->int_name);
        if (rt)
                rtdelete(rt);
        if (rt)
                rtdelete(rt);
+       rtadd(dst, &ifp->int_addr, ifp->int_metric,
+               ifp->int_flags & (IFF_INTERFACE|IFF_PASSIVE|IFF_REMOTE));
 }
 
 /*
 }
 
 /*