static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle)
{
DPRINTK("tcindex_get(tp %p,handle 0x%08x)\n",tp,handle);
return (unsigned long) lookup(PRIV(tp),handle);
}
static struct tcindex_filter *lookup(struct tcindex_data *p,__u16 key)
{
struct tcindex_filter *f;
for (f = p->h[HASH(key)]; f; f = f->next)
if (f->key == key) break;
return f;
}
This tcindex_get function takes as input the 32-bit handle and a pointer to the tcf_proto structure, which contains the the information about the filter. It then calls the lookup function, which walks through the filter list to determine the filter with the specified handle. The lookup function returns the corresponding tcindex_filter structure, which contains the tcf_result structure as a member. The get function on a filter is invoked from the tc_ctl_tfilter function in net/sched/cls_api.c. If the tc_ctl_tfilter function is invoked to delete a filter, the get function returns the internal ID, which can then be used to call the destroy function on a filter.