Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netpfil/ipfw/ip_fw_table.c
Show First 20 Lines • Show All 1,651 Lines • ▼ Show 20 Lines | ipfw_unref_table(struct ip_fw_chain *ch, uint16_t kidx) | ||||
IPFW_UH_WLOCK_ASSERT(ch); | IPFW_UH_WLOCK_ASSERT(ch); | ||||
ni = CHAIN_TO_NI(ch); | ni = CHAIN_TO_NI(ch); | ||||
no = ipfw_objhash_lookup_kidx(ni, kidx); | no = ipfw_objhash_lookup_kidx(ni, kidx); | ||||
KASSERT(no != NULL, ("Table with index %d not found", kidx)); | KASSERT(no != NULL, ("Table with index %d not found", kidx)); | ||||
no->refcnt--; | no->refcnt--; | ||||
} | } | ||||
/* | /* | ||||
* Lookup an IP @addr in table @tbl. | |||||
* Stores found value in @val. | |||||
* | |||||
* Returns 1 if @addr was found. | |||||
*/ | |||||
int | |||||
ipfw_lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, | |||||
uint32_t *val) | |||||
{ | |||||
struct table_info *ti; | |||||
ti = KIDX_TO_TI(ch, tbl); | |||||
return (ti->lookup(ti, &addr, sizeof(in_addr_t), val)); | |||||
} | |||||
/* | |||||
* Lookup an arbtrary key @paddr of legth @plen in table @tbl. | * Lookup an arbtrary key @paddr of legth @plen in table @tbl. | ||||
* Stores found value in @val. | * Stores found value in @val. | ||||
* | * | ||||
* Returns 1 if key was found. | * Returns 1 if key was found. | ||||
*/ | */ | ||||
int | int | ||||
ipfw_lookup_table_extended(struct ip_fw_chain *ch, uint16_t tbl, uint16_t plen, | ipfw_lookup_table(struct ip_fw_chain *ch, uint16_t tbl, uint16_t plen, | ||||
void *paddr, uint32_t *val) | void *paddr, uint32_t *val) | ||||
{ | { | ||||
struct table_info *ti; | struct table_info *ti; | ||||
ti = KIDX_TO_TI(ch, tbl); | ti = KIDX_TO_TI(ch, tbl); | ||||
return (ti->lookup(ti, paddr, plen, val)); | return (ti->lookup(ti, paddr, plen, val)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,688 Lines • Show Last 20 Lines |