sbin/routed/rdisc.c
/* get rid of a dead discovered router
 */
get rid of a dead discovered router
get rid of a dead discovered router
static void
del_rdisc(struct dr *drp)
{
	struct interface *ifp;
	naddr gate;
	int i;
	del_redirects(gate = drp->dr_gate, 0);
	drp->dr_ts = 0;
	drp->dr_life = 0;
	i = 0;
	ifp = drp->dr_ifp;
	for (drp = drs; drp < &drs[MAX_ADS]; drp++) {
		if (drp->dr_ts != 0
		    && drp->dr_ifp == ifp)
			i++;
	}
	if (i != 0) {
		trace_act("discovered router %s via %s"
			  " is bad--have %d remaining",
			  naddr_ntoa(gate), ifp->int_name, i);
	} else if (ifp->int_rdisc_cnt >= MAX_SOLICITATIONS) {
		trace_act("last discovered router %s via %s"
			  " is bad--re-solicit",
			  naddr_ntoa(gate), ifp->int_name);
		ifp->int_rdisc_cnt = 0;
		ifp->int_rdisc_timer.tv_sec = 0;
		rdisc_sol();
	} else {
		trace_act("last discovered router %s via %s"
			  " is bad--wait to solicit",
			  naddr_ntoa(gate), ifp->int_name);
	}
}
static void del_rdisc ( struct dr * drp ) { struct interface * ifp ; naddr gate ; int i ; del_redirects ( gate = drp -> dr_gate , 0 ) ; drp -> dr_ts = 0 ; drp -> dr_life = 0 ; i = 0 ; ifp = drp -> dr_ifp ; for ( drp = drs ; drp < & drs [ MAX_ADS ] ; drp ++ ) { if ( drp -> dr_ts != 0 && drp -> dr_ifp == ifp ) i ++ ; } if ( i != 0 ) { trace_act ( " " " " , naddr_ntoa ( gate ) , ifp -> int_name , i ) ; } else if ( ifp -> int_rdisc_cnt >= MAX_SOLICITATIONS ) { trace_act ( " " " " , naddr_ntoa ( gate ) , ifp -> int_name ) ; ifp -> int_rdisc_cnt = 0 ; ifp -> int_rdisc_timer . tv_sec = 0 ; rdisc_sol ( ) ; } else { trace_act ( " " " " , naddr_ntoa ( gate ) , ifp -> int_name ) ; } }
get rid of a dead discovered router
get rid of a dead discovered router
/* Count the other discovered routes on the interface.
	 */ /* If that was the last good discovered router on the interface,
	 * then solicit a new one.
	 * This is contrary to RFC 1256, but defends against black holes.
	 */