FreeBSD/sys/netpfil/ipfw/ip_fw_table.c
/*
 * Finds table config based on either legacy index
 * or name in ntlv.
 * Note @ti structure contains unchecked data from userland.
 *
 * Returns 0 in success and fills in @tc with found config
 */
Finds table config based on either legacy index
or name in ntlv.
Note @ti structure contains unchecked data from userland.

Returns 0 in success and fills in @tc with found config
Finds table config based on either legacy index or name in ntlv . Note @ti structure contains unchecked data from userland . Returns 0 in success and fills in @tc with found config
static int
find_table_err(struct namedobj_instance *ni, struct tid_info *ti,
    struct table_config **tc)
{
	char *name, bname[16];
	struct named_object *no;
	ipfw_obj_ntlv *ntlv;
	uint32_t set;
	if (ti->tlvs != NULL) {
		ntlv = ipfw_find_name_tlv_type(ti->tlvs, ti->tlen, ti->uidx,
		    IPFW_TLV_TBL_NAME);
		if (ntlv == NULL)
			return (EINVAL);
		name = ntlv->name;
		set = (V_fw_tables_sets != 0) ? ti->set : 0;
	} else {
		snprintf(bname, sizeof(bname), "%d", ti->uidx);
		name = bname;
		set = 0;
	}
	no = ipfw_objhash_lookup_name(ni, set, name);
	*tc = (struct table_config *)no;
	return (0);
}
static int find_table_err ( struct namedobj_instance * ni , struct tid_info * ti , struct table_config * * tc ) { char * name , bname [ 16 ] ; struct named_object * no ; ipfw_obj_ntlv * ntlv ; uint32_t set ; if ( ti -> tlvs != NULL ) { ntlv = ipfw_find_name_tlv_type ( ti -> tlvs , ti -> tlen , ti -> uidx , IPFW_TLV_TBL_NAME ) ; if ( ntlv == NULL ) return ( EINVAL ) ; name = ntlv -> name ; set = ( V_fw_tables_sets != 0 ) ? ti -> set : 0 ; } else { snprintf ( bname , sizeof ( bname ) , " " , ti -> uidx ) ; name = bname ; set = 0 ; } no = ipfw_objhash_lookup_name ( ni , set , name ) ; * tc = ( struct table_config * ) no ; return ( 0 ) ; }
Finds table config based on either legacy index
 or name in ntlv.
Finds table config based on either legacy index or name in ntlv .
/*
		 * Use set provided by @ti instead of @ntlv one.
		 * This is needed due to different sets behavior
		 * controlled by V_fw_tables_sets.
		 */