1 --- a/net/ipv4/netfilter/ip_tables.c
2 +++ b/net/ipv4/netfilter/ip_tables.c
3 @@ -310,6 +310,33 @@ struct ipt_entry *ipt_next_entry(const s
4 return (void *)entry + entry->next_offset;
8 +ipt_handle_default_rule(struct ipt_entry *e, unsigned int *verdict)
10 + struct xt_entry_target *t;
11 + struct xt_standard_target *st;
13 + if (e->target_offset != sizeof(struct ipt_entry))
16 + if (!(e->ip.flags & IPT_F_NO_DEF_MATCH))
19 + t = ipt_get_target(e);
20 + if (t->u.kernel.target->target)
23 + st = (struct xt_standard_target *) t;
24 + if (st->verdict == XT_RETURN)
27 + if (st->verdict >= 0)
30 + *verdict = (unsigned)(-st->verdict) - 1;
34 /* Returns one of the generic firewall policies, like NF_ACCEPT. */
36 ipt_do_table(struct sk_buff *skb,
37 @@ -331,9 +358,27 @@ ipt_do_table(struct sk_buff *skb,
41 + IP_NF_ASSERT(table->valid_hooks & (1 << hook));
43 + private = table->private;
44 + cpu = smp_processor_id();
45 + table_base = private->entries[cpu];
46 + e = get_entry(table_base, private->hook_entry[hook]);
47 + if (ipt_handle_default_rule(e, &verdict)) {
48 + ADD_COUNTER(e->counters, skb->len, 1);
54 indev = in ? in->name : nulldevname;
55 outdev = out ? out->name : nulldevname;
57 + addend = xt_write_recseq_begin();
58 + jumpstack = (struct ipt_entry **)private->jumpstack[cpu];
59 + stackptr = per_cpu_ptr(private->stackptr, cpu);
60 + origptr = *stackptr;
62 /* We handle fragments by dealing with the first fragment as
63 * if it was a normal packet. All other fragments are treated
64 * normally, except that they will NEVER match rules that ask
65 @@ -348,18 +393,6 @@ ipt_do_table(struct sk_buff *skb,
66 acpar.family = NFPROTO_IPV4;
69 - IP_NF_ASSERT(table->valid_hooks & (1 << hook));
71 - addend = xt_write_recseq_begin();
72 - private = table->private;
73 - cpu = smp_processor_id();
74 - table_base = private->entries[cpu];
75 - jumpstack = (struct ipt_entry **)private->jumpstack[cpu];
76 - stackptr = per_cpu_ptr(private->stackptr, cpu);
77 - origptr = *stackptr;
79 - e = get_entry(table_base, private->hook_entry[hook]);
81 pr_debug("Entering %s(hook %u); sp at %u (UF %p)\n",
82 table->name, hook, origptr,
83 get_entry(table_base, private->underflow[hook]));