]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/ipv4/netfilter/ip_tables.c
Merge tag 'v2.6.37' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / net / ipv4 / netfilter / ip_tables.c
index d163f2e3b2e99e5f18ae9997d3c74867b3e79354..a846d633b3b6f04a3ed72be1d884e484d3efa030 100644 (file)
@@ -186,7 +186,7 @@ static inline bool unconditional(const struct ipt_ip *ip)
 }
 
 /* for const-correctness */
-static inline const struct ipt_entry_target *
+static inline const struct xt_entry_target *
 ipt_get_target_c(const struct ipt_entry *e)
 {
        return ipt_get_target((struct ipt_entry *)e);
@@ -230,9 +230,9 @@ get_chainname_rulenum(const struct ipt_entry *s, const struct ipt_entry *e,
                      const char *hookname, const char **chainname,
                      const char **comment, unsigned int *rulenum)
 {
-       const struct ipt_standard_target *t = (void *)ipt_get_target_c(s);
+       const struct xt_standard_target *t = (void *)ipt_get_target_c(s);
 
-       if (strcmp(t->target.u.kernel.target->name, IPT_ERROR_TARGET) == 0) {
+       if (strcmp(t->target.u.kernel.target->name, XT_ERROR_TARGET) == 0) {
                /* Head of user chain: ERROR target with chainname */
                *chainname = t->target.data;
                (*rulenum) = 0;
@@ -241,7 +241,7 @@ get_chainname_rulenum(const struct ipt_entry *s, const struct ipt_entry *e,
 
                if (s->target_offset == sizeof(struct ipt_entry) &&
                    strcmp(t->target.u.kernel.target->name,
-                          IPT_STANDARD_TARGET) == 0 &&
+                          XT_STANDARD_TARGET) == 0 &&
                   t->verdict < 0 &&
                   unconditional(&s->ip)) {
                        /* Tail of chains: STANDARD target (return/policy) */
@@ -346,7 +346,7 @@ ipt_do_table(struct sk_buff *skb,
                 get_entry(table_base, private->underflow[hook]));
 
        do {
-               const struct ipt_entry_target *t;
+               const struct xt_entry_target *t;
                const struct xt_entry_match *ematch;
 
                IP_NF_ASSERT(e);
@@ -380,10 +380,10 @@ ipt_do_table(struct sk_buff *skb,
                if (!t->u.kernel.target->target) {
                        int v;
 
-                       v = ((struct ipt_standard_target *)t)->verdict;
+                       v = ((struct xt_standard_target *)t)->verdict;
                        if (v < 0) {
                                /* Pop from stack? */
-                               if (v != IPT_RETURN) {
+                               if (v != XT_RETURN) {
                                        verdict = (unsigned)(-v) - 1;
                                        break;
                                }
@@ -421,7 +421,7 @@ ipt_do_table(struct sk_buff *skb,
                verdict = t->u.kernel.target->target(skb, &acpar);
                /* Target might have changed stuff. */
                ip = ip_hdr(skb);
-               if (verdict == IPT_CONTINUE)
+               if (verdict == XT_CONTINUE)
                        e = ipt_next_entry(e);
                else
                        /* Verdict */
@@ -461,7 +461,7 @@ mark_source_chains(const struct xt_table_info *newinfo,
                e->counters.pcnt = pos;
 
                for (;;) {
-                       const struct ipt_standard_target *t
+                       const struct xt_standard_target *t
                                = (void *)ipt_get_target_c(e);
                        int visited = e->comefrom & (1 << hook);
 
@@ -475,13 +475,13 @@ mark_source_chains(const struct xt_table_info *newinfo,
                        /* Unconditional return/END. */
                        if ((e->target_offset == sizeof(struct ipt_entry) &&
                             (strcmp(t->target.u.user.name,
-                                    IPT_STANDARD_TARGET) == 0) &&
+                                    XT_STANDARD_TARGET) == 0) &&
                             t->verdict < 0 && unconditional(&e->ip)) ||
                            visited) {
                                unsigned int oldpos, size;
 
                                if ((strcmp(t->target.u.user.name,
-                                           IPT_STANDARD_TARGET) == 0) &&
+                                           XT_STANDARD_TARGET) == 0) &&
                                    t->verdict < -NF_MAX_VERDICT - 1) {
                                        duprintf("mark_source_chains: bad "
                                                "negative verdict (%i)\n",
@@ -524,7 +524,7 @@ mark_source_chains(const struct xt_table_info *newinfo,
                                int newpos = t->verdict;
 
                                if (strcmp(t->target.u.user.name,
-                                          IPT_STANDARD_TARGET) == 0 &&
+                                          XT_STANDARD_TARGET) == 0 &&
                                    newpos >= 0) {
                                        if (newpos > newinfo->size -
                                                sizeof(struct ipt_entry)) {
@@ -552,7 +552,7 @@ mark_source_chains(const struct xt_table_info *newinfo,
        return 1;
 }
 
-static void cleanup_match(struct ipt_entry_match *m, struct net *net)
+static void cleanup_match(struct xt_entry_match *m, struct net *net)
 {
        struct xt_mtdtor_param par;
 
@@ -568,14 +568,14 @@ static void cleanup_match(struct ipt_entry_match *m, struct net *net)
 static int
 check_entry(const struct ipt_entry *e, const char *name)
 {
-       const struct ipt_entry_target *t;
+       const struct xt_entry_target *t;
 
        if (!ip_checkentry(&e->ip)) {
                duprintf("ip check failed %p %s.\n", e, par->match->name);
                return -EINVAL;
        }
 
-       if (e->target_offset + sizeof(struct ipt_entry_target) >
+       if (e->target_offset + sizeof(struct xt_entry_target) >
            e->next_offset)
                return -EINVAL;
 
@@ -587,7 +587,7 @@ check_entry(const struct ipt_entry *e, const char *name)
 }
 
 static int
-check_match(struct ipt_entry_match *m, struct xt_mtchk_param *par)
+check_match(struct xt_entry_match *m, struct xt_mtchk_param *par)
 {
        const struct ipt_ip *ip = par->entryinfo;
        int ret;
@@ -605,7 +605,7 @@ check_match(struct ipt_entry_match *m, struct xt_mtchk_param *par)
 }
 
 static int
-find_check_match(struct ipt_entry_match *m, struct xt_mtchk_param *par)
+find_check_match(struct xt_entry_match *m, struct xt_mtchk_param *par)
 {
        struct xt_match *match;
        int ret;
@@ -630,7 +630,7 @@ err:
 
 static int check_target(struct ipt_entry *e, struct net *net, const char *name)
 {
-       struct ipt_entry_target *t = ipt_get_target(e);
+       struct xt_entry_target *t = ipt_get_target(e);
        struct xt_tgchk_param par = {
                .net       = net,
                .table     = name,
@@ -656,7 +656,7 @@ static int
 find_check_entry(struct ipt_entry *e, struct net *net, const char *name,
                 unsigned int size)
 {
-       struct ipt_entry_target *t;
+       struct xt_entry_target *t;
        struct xt_target *target;
        int ret;
        unsigned int j;
@@ -707,7 +707,7 @@ find_check_entry(struct ipt_entry *e, struct net *net, const char *name,
 
 static bool check_underflow(const struct ipt_entry *e)
 {
-       const struct ipt_entry_target *t;
+       const struct xt_entry_target *t;
        unsigned int verdict;
 
        if (!unconditional(&e->ip))
@@ -715,7 +715,7 @@ static bool check_underflow(const struct ipt_entry *e)
        t = ipt_get_target_c(e);
        if (strcmp(t->u.user.name, XT_STANDARD_TARGET) != 0)
                return false;
-       verdict = ((struct ipt_standard_target *)t)->verdict;
+       verdict = ((struct xt_standard_target *)t)->verdict;
        verdict = -verdict - 1;
        return verdict == NF_DROP || verdict == NF_ACCEPT;
 }
@@ -738,7 +738,7 @@ check_entry_size_and_hooks(struct ipt_entry *e,
        }
 
        if (e->next_offset
-           < sizeof(struct ipt_entry) + sizeof(struct ipt_entry_target)) {
+           < sizeof(struct ipt_entry) + sizeof(struct xt_entry_target)) {
                duprintf("checking: element %p size %u\n",
                         e, e->next_offset);
                return -EINVAL;
@@ -771,7 +771,7 @@ static void
 cleanup_entry(struct ipt_entry *e, struct net *net)
 {
        struct xt_tgdtor_param par;
-       struct ipt_entry_target *t;
+       struct xt_entry_target *t;
        struct xt_entry_match *ematch;
 
        /* Cleanup all matches */
@@ -972,8 +972,8 @@ copy_entries_to_user(unsigned int total_size,
        /* ... then go back and fix counters and names */
        for (off = 0, num = 0; off < total_size; off += e->next_offset, num++){
                unsigned int i;
-               const struct ipt_entry_match *m;
-               const struct ipt_entry_target *t;
+               const struct xt_entry_match *m;
+               const struct xt_entry_target *t;
 
                e = (struct ipt_entry *)(loc_cpu_entry + off);
                if (copy_to_user(userptr + off
@@ -990,7 +990,7 @@ copy_entries_to_user(unsigned int total_size,
                        m = (void *)e + i;
 
                        if (copy_to_user(userptr + off + i
-                                        + offsetof(struct ipt_entry_match,
+                                        + offsetof(struct xt_entry_match,
                                                    u.user.name),
                                         m->u.kernel.match->name,
                                         strlen(m->u.kernel.match->name)+1)
@@ -1002,7 +1002,7 @@ copy_entries_to_user(unsigned int total_size,
 
                t = ipt_get_target_c(e);
                if (copy_to_user(userptr + off + e->target_offset
-                                + offsetof(struct ipt_entry_target,
+                                + offsetof(struct xt_entry_target,
                                            u.user.name),
                                 t->u.kernel.target->name,
                                 strlen(t->u.kernel.target->name)+1) != 0) {
@@ -1040,7 +1040,7 @@ static int compat_calc_entry(const struct ipt_entry *e,
                             const void *base, struct xt_table_info *newinfo)
 {
        const struct xt_entry_match *ematch;
-       const struct ipt_entry_target *t;
+       const struct xt_entry_target *t;
        unsigned int entry_offset;
        int off, i, ret;
 
@@ -1092,7 +1092,7 @@ static int compat_table_info(const struct xt_table_info *info,
 static int get_info(struct net *net, void __user *user,
                     const int *len, int compat)
 {
-       char name[IPT_TABLE_MAXNAMELEN];
+       char name[XT_TABLE_MAXNAMELEN];
        struct xt_table *t;
        int ret;
 
@@ -1105,7 +1105,7 @@ static int get_info(struct net *net, void __user *user,
        if (copy_from_user(name, user, sizeof(name)) != 0)
                return -EFAULT;
 
-       name[IPT_TABLE_MAXNAMELEN-1] = '\0';
+       name[XT_TABLE_MAXNAMELEN-1] = '\0';
 #ifdef CONFIG_COMPAT
        if (compat)
                xt_compat_lock(AF_INET);
@@ -1124,6 +1124,7 @@ static int get_info(struct net *net, void __user *user,
                        private = &tmp;
                }
 #endif
+               memset(&info, 0, sizeof(info));
                info.valid_hooks = t->valid_hooks;
                memcpy(info.hook_entry, private->hook_entry,
                       sizeof(info.hook_entry));
@@ -1400,14 +1401,14 @@ do_add_counters(struct net *net, const void __user *user,
 
 #ifdef CONFIG_COMPAT
 struct compat_ipt_replace {
-       char                    name[IPT_TABLE_MAXNAMELEN];
+       char                    name[XT_TABLE_MAXNAMELEN];
        u32                     valid_hooks;
        u32                     num_entries;
        u32                     size;
        u32                     hook_entry[NF_INET_NUMHOOKS];
        u32                     underflow[NF_INET_NUMHOOKS];
        u32                     num_counters;
-       compat_uptr_t           counters;       /* struct ipt_counters * */
+       compat_uptr_t           counters;       /* struct xt_counters * */
        struct compat_ipt_entry entries[0];
 };
 
@@ -1416,7 +1417,7 @@ compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr,
                          unsigned int *size, struct xt_counters *counters,
                          unsigned int i)
 {
-       struct ipt_entry_target *t;
+       struct xt_entry_target *t;
        struct compat_ipt_entry __user *ce;
        u_int16_t target_offset, next_offset;
        compat_uint_t origsize;
@@ -1451,7 +1452,7 @@ compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr,
 }
 
 static int
-compat_find_calc_match(struct ipt_entry_match *m,
+compat_find_calc_match(struct xt_entry_match *m,
                       const char *name,
                       const struct ipt_ip *ip,
                       unsigned int hookmask,
@@ -1473,7 +1474,7 @@ compat_find_calc_match(struct ipt_entry_match *m,
 
 static void compat_release_entry(struct compat_ipt_entry *e)
 {
-       struct ipt_entry_target *t;
+       struct xt_entry_target *t;
        struct xt_entry_match *ematch;
 
        /* Cleanup all matches */
@@ -1494,7 +1495,7 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e,
                                  const char *name)
 {
        struct xt_entry_match *ematch;
-       struct ipt_entry_target *t;
+       struct xt_entry_target *t;
        struct xt_target *target;
        unsigned int entry_offset;
        unsigned int j;
@@ -1576,7 +1577,7 @@ compat_copy_entry_from_user(struct compat_ipt_entry *e, void **dstptr,
                            unsigned int *size, const char *name,
                            struct xt_table_info *newinfo, unsigned char *base)
 {
-       struct ipt_entry_target *t;
+       struct xt_entry_target *t;
        struct xt_target *target;
        struct ipt_entry *de;
        unsigned int origsize;
@@ -1884,7 +1885,7 @@ compat_do_ipt_set_ctl(struct sock *sk,    int cmd, void __user *user,
 }
 
 struct compat_ipt_get_entries {
-       char name[IPT_TABLE_MAXNAMELEN];
+       char name[XT_TABLE_MAXNAMELEN];
        compat_uint_t size;
        struct compat_ipt_entry entrytable[0];
 };
@@ -2039,7 +2040,7 @@ do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 
        case IPT_SO_GET_REVISION_MATCH:
        case IPT_SO_GET_REVISION_TARGET: {
-               struct ipt_get_revision rev;
+               struct xt_get_revision rev;
                int target;
 
                if (*len != sizeof(rev)) {
@@ -2176,7 +2177,7 @@ static int icmp_checkentry(const struct xt_mtchk_param *par)
 
 static struct xt_target ipt_builtin_tg[] __read_mostly = {
        {
-               .name             = IPT_STANDARD_TARGET,
+               .name             = XT_STANDARD_TARGET,
                .targetsize       = sizeof(int),
                .family           = NFPROTO_IPV4,
 #ifdef CONFIG_COMPAT
@@ -2186,9 +2187,9 @@ static struct xt_target ipt_builtin_tg[] __read_mostly = {
 #endif
        },
        {
-               .name             = IPT_ERROR_TARGET,
+               .name             = XT_ERROR_TARGET,
                .target           = ipt_error,
-               .targetsize       = IPT_FUNCTION_MAXNAMELEN,
+               .targetsize       = XT_FUNCTION_MAXNAMELEN,
                .family           = NFPROTO_IPV4,
        },
 };