FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Dumps table in pre-8.1 legacy format.
 */
Dumps table in pre-8.1 legacy format.
Dumps table in pre - 8 . 1 legacy format .
int
ipfw_dump_table_legacy(struct ip_fw_chain *ch, struct tid_info *ti,
    ipfw_table *tbl)
{
	struct table_config *tc;
	struct table_algo *ta;
	struct dump_args da;
	tbl->cnt = 0;
	if ((tc = find_table(CHAIN_TO_NI(ch), ti)) == NULL)
		return (0);	
	ta = tc->ta;
	if (tc->no.subtype != IPFW_TABLE_ADDR)
		return (0);
	memset(&da, 0, sizeof(da));
	da.ch = ch;
	da.ti = KIDX_TO_TI(ch, tc->no.kidx);
	da.tc = tc;
	da.ent = &tbl->ent[0];
	da.size = tbl->size;
	tbl->cnt = 0;
	ta->foreach(tc->astate, da.ti, dump_table_entry, &da);
	tbl->cnt = da.cnt;
	return (0);
}
int ipfw_dump_table_legacy ( struct ip_fw_chain * ch , struct tid_info * ti , ipfw_table * tbl ) { struct table_config * tc ; struct table_algo * ta ; struct dump_args da ; tbl -> cnt = 0 ; if ( ( tc = find_table ( CHAIN_TO_NI ( ch ) , ti ) ) == NULL ) return ( 0 ) ; ta = tc -> ta ; if ( tc -> no . subtype != IPFW_TABLE_ADDR ) return ( 0 ) ; memset ( & da , 0 , sizeof ( da ) ) ; da . ch = ch ; da . ti = KIDX_TO_TI ( ch , tc -> no . kidx ) ; da . tc = tc ; da . ent = & tbl -> ent [ 0 ] ; da . size = tbl -> size ; tbl -> cnt = 0 ; ta -> foreach ( tc -> astate , da . ti , dump_table_entry , & da ) ; tbl -> cnt = da . cnt ; return ( 0 ) ; }
Dumps table in pre-8.1 legacy format.
Dumps table in pre - 8 . 1 legacy format .
/* XXX: We should return ESRCH */ /* This dump format supports IPv4 only */