在limit/hashlimit等扩展模块的内核实现中,经常会看到如下的模式
int xxx_check_entry(..., void *matchinfo, ...)
{
struct ipt_xxx_info *r = matchinfo;
...
/* Ugly hack: For SMP, we only want to use one set */
r->master = r;
...
}
int xxx_match(..., void *matchinfo, ...)
{
struct ipt_xxx_info *r = matchinfo;
r = r->master;
...
}
注释里已经说的很清楚了