private = table->private; table_base = (void *)private->entries[smp_processor_id(); e = get_entry(table_base, private->hook_entry[hook); |
#define IPT_MATCH_ITERATE(e, fn, args...) \ ({ \ unsigned int __i; \ int __ret = 0; \ struct ipt_entry_match *__match; \ \ for (__i = sizeof(struct ipt_entry); \ __i < (e)->target_offset; \ __i += __match->u.match_size) { \ __match = (void *)(e) + __i; \ \ __ret = fn(__match , ## args); \ if (__ret != 0) \ break; \ } \ __ret; \ }) |
static __inline__ struct ipt_entry_target * ipt_get_target(struct ipt_entry *e) { return (void *)e + e->target_offset; } |
e = (void *)e + e->next_offset; |
int xt_register_match(struct xt_match *match) { int ret, af = match->family; ret = mutex_lock_interruptible(&xt[af.mutex); if (ret != 0) return ret; list_add(&match->list, &xt[af.match); mutex_unlock(&xt[af.mutex); return ret; } |
int xt_register_table(struct xt_table *table, struct xt_table_info *bootstrap, struct xt_table_info *newinfo) { int ret; struct xt_table_info *private; struct xt_table *t; ret = mutex_lock_interruptible(&xt[table->af.mutex); if (ret != 0) return ret; /* Don't autoload: we'd eat our tail... */ list_for_each_entry(t, &xt[table->af.tables, list) { if (strcmp(t->name, table->name) == 0) { ret = -EEXIST; goto unlock; } } /* Simplifies replace_table code. */ table->private = bootstrap; rwlock_init(&table->lock); if (!xt_replace_table(table, 0, newinfo, &ret)) goto unlock; private = table->private; duprintf("table->private->number = %u\n", private->number); /* save number of initial entries */ private->initial_entries = private->number; list_add(&table->list, &xt[table->af.tables); ret = 0; unlock: mutex_unlock(&xt[table->af.mutex); return ret; } |
int nf_register_hook(struct nf_hook_ops *reg) { struct list_head *i; int err; err = mutex_lock_interruptible(&nf_hook_mutex); if (err < 0) return err; list_for_each(i, &nf_hooks[reg->pf[reg->hooknum) { if (reg->priority < ((struct nf_hook_ops *)i)->priority) break; } list_add_rcu(®->list, i->prev); mutex_unlock(&nf_hook_mutex); return 0; } |
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |