+ /*
+ * 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 | RTS_REMOTE)))
+ rt->rt_timer = 0;
+ else if ((ifp = if_ifwithdstaddr(from)) &&
+ (rt == 0 || rt->rt_metric >= ifp->int_metric))
+ addrouteforif(ifp);
+ /*
+ * "Authenticate" router from which message originated.
+ * We accept routing packets from routers directly connected
+ * via broadcast or point-to-point networks,
+ * and from those listed in /etc/gateways.
+ */
+ if ((ifp = if_iflookup(from)) == 0 || (ifp->int_flags &
+ (IFF_BROADCAST | IFF_POINTOPOINT | IFF_REMOTE)) == 0 ||
+ ifp->int_flags & IFF_PASSIVE) {
+ if (bcmp((char *)from, (char *)&badfrom,
+ sizeof(badfrom)) != 0) {
+ syslog(LOG_ERR,
+ "packet from unknown router, %s",
+ (*afswitch[from->sa_family].af_format)(from));
+ badfrom = *from;
+ }
+ return;
+ }