linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / net / ipv4 / netfilter / ipt_SAME.c
index 7169b09..a22de59 100644 (file)
@@ -50,7 +50,6 @@ MODULE_DESCRIPTION("iptables special SNAT module for consistent sourceip");
 static int
 same_check(const char *tablename,
              const void *e,
-             const struct xt_target *target,
              void *targinfo,
              unsigned int targinfosize,
              unsigned int hook_mask)
@@ -60,6 +59,18 @@ same_check(const char *tablename,
 
        mr->ipnum = 0;
 
+       if (strcmp(tablename, "nat") != 0) {
+               DEBUGP("same_check: bad table `%s'.\n", tablename);
+               return 0;
+       }
+       if (targinfosize != IPT_ALIGN(sizeof(*mr))) {
+               DEBUGP("same_check: size %u.\n", targinfosize);
+               return 0;
+       }
+       if (hook_mask & ~(1 << NF_IP_PRE_ROUTING | 1 << NF_IP_POST_ROUTING)) {
+               DEBUGP("same_check: bad hooks %x.\n", hook_mask);
+               return 0;
+       }
        if (mr->rangesize < 1) {
                DEBUGP("same_check: need at least one dest range.\n");
                return 0;
@@ -116,7 +127,7 @@ same_check(const char *tablename,
 }
 
 static void 
-same_destroy(const struct xt_target *target, void *targinfo,
+same_destroy(void *targinfo,
                unsigned int targinfosize)
 {
        struct ipt_same_info *mr = targinfo;
@@ -132,7 +143,6 @@ same_target(struct sk_buff **pskb,
                const struct net_device *in,
                const struct net_device *out,
                unsigned int hooknum,
-               const struct xt_target *target,
                const void *targinfo,
                void *userinfo)
 {
@@ -181,24 +191,21 @@ same_target(struct sk_buff **pskb,
 static struct ipt_target same_reg = { 
        .name           = "SAME",
        .target         = same_target,
-       .targetsize     = sizeof(struct ipt_same_info),
-       .table          = "nat",
-       .hooks          = (1 << NF_IP_PRE_ROUTING | 1 << NF_IP_POST_ROUTING),
        .checkentry     = same_check,
        .destroy        = same_destroy,
        .me             = THIS_MODULE,
 };
 
-static int __init ipt_same_init(void)
+static int __init init(void)
 {
        return ipt_register_target(&same_reg);
 }
 
-static void __exit ipt_same_fini(void)
+static void __exit fini(void)
 {
        ipt_unregister_target(&same_reg);
 }
 
-module_init(ipt_same_init);
-module_exit(ipt_same_fini);
+module_init(init);
+module_exit(fini);