FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Dumps table entry in eXtended format (v0).
 */
Dumps table entry in eXtended format (v0).
Dumps table entry in eXtended format ( v0 ) .
static int
dump_table_xentry(void *e, void *arg)
{
	struct dump_args *da;
	struct table_config *tc;
	struct table_algo *ta;
	ipfw_table_xentry *xent;
	ipfw_obj_tentry *tent;
	struct table_value *pval;
	int error;
	da = (struct dump_args *)arg;
	tc = da->tc;
	ta = tc->ta;
	xent = (ipfw_table_xentry *)ipfw_get_sopt_space(da->sd, sizeof(*xent));
	if (xent == NULL)
		return (1);
	xent->len = sizeof(ipfw_table_xentry);
	xent->tbl = da->uidx;
	memset(&da->tent, 0, sizeof(da->tent));
	tent = &da->tent;
	error = ta->dump_tentry(tc->astate, da->ti, e, tent);
	if (error != 0)
		return (error);
	xent->masklen = tent->masklen;
	pval = get_table_value(da->ch, da->tc, da->tent.v.kidx);
	xent->value = ipfw_export_table_value_legacy(pval);
	if (tc->no.subtype == IPFW_TABLE_ADDR && tent->subtype == AF_INET) {
		xent->k.addr6.s6_addr32[3] = tent->k.addr.s_addr;
		xent->flags = IPFW_TCF_INET;
	} else
		memcpy(&xent->k, &tent->k, sizeof(xent->k));
	return (0);
}
static int dump_table_xentry ( void * e , void * arg ) { struct dump_args * da ; struct table_config * tc ; struct table_algo * ta ; ipfw_table_xentry * xent ; ipfw_obj_tentry * tent ; struct table_value * pval ; int error ; da = ( struct dump_args * ) arg ; tc = da -> tc ; ta = tc -> ta ; xent = ( ipfw_table_xentry * ) ipfw_get_sopt_space ( da -> sd , sizeof ( * xent ) ) ; if ( xent == NULL ) return ( 1 ) ; xent -> len = sizeof ( ipfw_table_xentry ) ; xent -> tbl = da -> uidx ; memset ( & da -> tent , 0 , sizeof ( da -> tent ) ) ; tent = & da -> tent ; error = ta -> dump_tentry ( tc -> astate , da -> ti , e , tent ) ; if ( error != 0 ) return ( error ) ; xent -> masklen = tent -> masklen ; pval = get_table_value ( da -> ch , da -> tc , da -> tent . v . kidx ) ; xent -> value = ipfw_export_table_value_legacy ( pval ) ; if ( tc -> no . subtype == IPFW_TABLE_ADDR && tent -> subtype == AF_INET ) { xent -> k . addr6 . s6_addr32 [ 3 ] = tent -> k . addr . s_addr ; xent -> flags = IPFW_TCF_INET ; } else memcpy ( & xent -> k , & tent -> k , sizeof ( xent -> k ) ) ; return ( 0 ) ; }
Dumps table entry in eXtended format (v0).
Dumps table entry in eXtended format ( v0 ) .
/* Out of memory, returning */ /* Convert current format to previous one */ /* Apply some hacks */