FreeBSD/sys/netpfil/ipfw/ip_fw_sockopt.c
/*
 * Finds object 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 @pno with found config
 */
Finds object 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 @pno with found config
Finds object 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 @pno with found config
int
ipfw_objhash_find_type(struct namedobj_instance *ni, struct tid_info *ti,
    uint32_t etlv, struct named_object **pno)
{
	char *name;
	ipfw_obj_ntlv *ntlv;
	uint32_t set;
	if (ti->tlvs == NULL)
		return (EINVAL);
	ntlv = ipfw_find_name_tlv_type(ti->tlvs, ti->tlen, ti->uidx, etlv);
	if (ntlv == NULL)
		return (EINVAL);
	name = ntlv->name;
	set = ti->set;
	*pno = ipfw_objhash_lookup_name(ni, set, name);
	if (*pno == NULL)
		return (ESRCH);
	return (0);
}
int ipfw_objhash_find_type ( struct namedobj_instance * ni , struct tid_info * ti , uint32_t etlv , struct named_object * * pno ) { char * name ; ipfw_obj_ntlv * ntlv ; uint32_t set ; if ( ti -> tlvs == NULL ) return ( EINVAL ) ; ntlv = ipfw_find_name_tlv_type ( ti -> tlvs , ti -> tlen , ti -> uidx , etlv ) ; if ( ntlv == NULL ) return ( EINVAL ) ; name = ntlv -> name ; set = ti -> set ; * pno = ipfw_objhash_lookup_name ( ni , set , name ) ; if ( * pno == NULL ) return ( ESRCH ) ; return ( 0 ) ; }
Finds object config based on either legacy index
 or name in ntlv.
Finds object 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.
	 */