FreeBSD/sys/netinet6/ip6_mroute.c
/*
 * Clean up cache entries if upcalls are not serviced
 * Call from the Slow Timeout mechanism, every half second.
 */
Clean up cache entries if upcalls are not serviced
Call from the Slow Timeout mechanism, every half second.
Clean up cache entries if upcalls are not serviced Call from the Slow Timeout mechanism every half second .
static void
expire_upcalls(void *unused)
{
#ifdef MRT6DEBUG
	char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN];
#endif
	struct rtdetq *rte;
	struct mf6c *mfc, **nptr;
	u_long i;
	MFC6_LOCK();
	for (i = 0; i < MF6CTBLSIZ; i++) {
		if (n6expire[i] == 0)
			continue;
		nptr = &mf6ctable[i];
		while ((mfc = *nptr) != NULL) {
			rte = mfc->mf6c_stall;
			if (rte != NULL &&
			    mfc->mf6c_expire != 0 &&
			    --mfc->mf6c_expire == 0) {
				MRT6_DLOG(DEBUG_EXPIRE, "expiring (%s %s)",
				    ip6_sprintf(ip6bufo, &mfc->mf6c_origin.sin6_addr),
				    ip6_sprintf(ip6bufg, &mfc->mf6c_mcastgrp.sin6_addr));
				do {
					struct rtdetq *n = rte->next;
					m_freem(rte->m);
					free(rte, M_MRTABLE6);
					rte = n;
				} while (rte != NULL);
				MRT6STAT_INC(mrt6s_cache_cleanups);
				n6expire[i]--;
				*nptr = mfc->mf6c_next;
				free(mfc, M_MRTABLE6);
			} else {
				nptr = &mfc->mf6c_next;
			}
		}
	}
	MFC6_UNLOCK();
	callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT,
	    expire_upcalls, NULL);
}
static void expire_upcalls ( void * unused ) { #ifdef MRT6DEBUG char ip6bufo [ INET6_ADDRSTRLEN ] , ip6bufg [ INET6_ADDRSTRLEN ] ; #endif struct rtdetq * rte ; struct mf6c * mfc , * * nptr ; u_long i ; MFC6_LOCK ( ) ; for ( i = 0 ; i < MF6CTBLSIZ ; i ++ ) { if ( n6expire [ i ] == 0 ) continue ; nptr = & mf6ctable [ i ] ; while ( ( mfc = * nptr ) != NULL ) { rte = mfc -> mf6c_stall ; if ( rte != NULL && mfc -> mf6c_expire != 0 && -- mfc -> mf6c_expire == 0 ) { MRT6_DLOG ( DEBUG_EXPIRE , " " , ip6_sprintf ( ip6bufo , & mfc -> mf6c_origin . sin6_addr ) , ip6_sprintf ( ip6bufg , & mfc -> mf6c_mcastgrp . sin6_addr ) ) ; do { struct rtdetq * n = rte -> next ; m_freem ( rte -> m ) ; free ( rte , M_MRTABLE6 ) ; rte = n ; } while ( rte != NULL ) ; MRT6STAT_INC ( mrt6s_cache_cleanups ) ; n6expire [ i ] -- ; * nptr = mfc -> mf6c_next ; free ( mfc , M_MRTABLE6 ) ; } else { nptr = & mfc -> mf6c_next ; } } } MFC6_UNLOCK ( ) ; callout_reset ( & expire_upcalls_ch , EXPIRE_TIMEOUT , expire_upcalls , NULL ) ; }
Clean up cache entries if upcalls are not serviced
 Call from the Slow Timeout mechanism, every half second.
Clean up cache entries if upcalls are not serviced Call from the Slow Timeout mechanism every half second .
/*
			 * Skip real cache entries
			 * Make sure it wasn't marked to not expire (shouldn't happen)
			 * If it expires now
			 */ /*
				 * drop all the packets
				 * free the mbuf with the pkt, if, timing info
				 */