FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Store table info to buffer provided by @sd.
 * Data layout (v0)(current):
 * Request: [ ipfw_obj_header ipfw_xtable_info(empty)]
 * Reply: [ ipfw_obj_header ipfw_xtable_info ]
 *
 * Returns 0 on success.
 */
Store table info to buffer provided by @sd.

Returns 0 on success.
Store table info to buffer provided by @sd . Returns 0 on success .
static int
describe_table(struct ip_fw_chain *ch, ip_fw3_opheader *op3,
    struct sockopt_data *sd)
{
	struct _ipfw_obj_header *oh;
	struct table_config *tc;
	struct tid_info ti;
	size_t sz;
	sz = sizeof(*oh) + sizeof(ipfw_xtable_info);
	oh = (struct _ipfw_obj_header *)ipfw_get_sopt_header(sd, sz);
	if (oh == NULL)
		return (EINVAL);
	objheader_to_ti(oh, &ti);
	IPFW_UH_RLOCK(ch);
	if ((tc = find_table(CHAIN_TO_NI(ch), &ti)) == NULL) {
		IPFW_UH_RUNLOCK(ch);
		return (ESRCH);
	}
	export_table_info(ch, tc, (ipfw_xtable_info *)(oh + 1));
	IPFW_UH_RUNLOCK(ch);
	return (0);
}
static int describe_table ( struct ip_fw_chain * ch , ip_fw3_opheader * op3 , struct sockopt_data * sd ) { struct _ipfw_obj_header * oh ; struct table_config * tc ; struct tid_info ti ; size_t sz ; sz = sizeof ( * oh ) + sizeof ( ipfw_xtable_info ) ; oh = ( struct _ipfw_obj_header * ) ipfw_get_sopt_header ( sd , sz ) ; if ( oh == NULL ) return ( EINVAL ) ; objheader_to_ti ( oh , & ti ) ; IPFW_UH_RLOCK ( ch ) ; if ( ( tc = find_table ( CHAIN_TO_NI ( ch ) , & ti ) ) == NULL ) { IPFW_UH_RUNLOCK ( ch ) ; return ( ESRCH ) ; } export_table_info ( ch , tc , ( ipfw_xtable_info * ) ( oh + 1 ) ) ; IPFW_UH_RUNLOCK ( ch ) ; return ( 0 ) ; }
Store table info to buffer provided by @sd.
Store table info to buffer provided by @sd .