reinstall point-to-point interface when it reappears
[unix-history] / usr / src / sbin / routed / input.c
index a09aea9..e1f8376 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)input.c    4.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)input.c    4.10 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -94,9 +94,15 @@ rip_input(from, size)
                                rt->rt_timer = 0;
                        return;
                }
                                rt->rt_timer = 0;
                        return;
                }
-               /* update timer for interface on which the packet arrived */
+               /*
+                * Update timer for interface on which the packet arrived.
+                * If from other end of a point-to-point link that isn't
+                * in the routing tables, (re-)add the route.
+                */
                if ((rt = rtfind(from)) && (rt->rt_state & RTS_INTERFACE))
                        rt->rt_timer = 0;
                if ((rt = rtfind(from)) && (rt->rt_state & RTS_INTERFACE))
                        rt->rt_timer = 0;
+               else if (ifp = if_ifwithdstaddr(from))
+                       addrouteforif(ifp);
                size -= 4 * sizeof (char);
                n = msg->rip_nets;
                for (; size > 0; size -= sizeof (struct netinfo), n++) {
                size -= 4 * sizeof (char);
                n = msg->rip_nets;
                for (; size > 0; size -= sizeof (struct netinfo), n++) {
@@ -109,6 +115,9 @@ rip_input(from, size)
                        }
                        if ((unsigned) n->rip_metric >= HOPCNT_INFINITY)
                                continue;
                        }
                        if ((unsigned) n->rip_metric >= HOPCNT_INFINITY)
                                continue;
+                       if (n->rip_dst.sa_family >= AF_MAX)
+                               continue;
+                       afp = &afswitch[n->rip_dst.sa_family];
                        if (((*afp->af_checkhost)(&n->rip_dst)) == 0)
                                continue;
                        rt = rtlookup(&n->rip_dst);
                        if (((*afp->af_checkhost)(&n->rip_dst)) == 0)
                                continue;
                        rt = rtlookup(&n->rip_dst);