[NETFILTER] x_tables: Abstraction layer for {ip,ip6,arp}_tables
[safe/jmp/linux-2.6] / net / netfilter / xt_realm.c
similarity index 70%
rename from net/ipv4/netfilter/ipt_realm.c
rename to net/netfilter/xt_realm.c
index 54a6897..2b7e178 100644 (file)
 #include <linux/netdevice.h>
 #include <net/route.h>
 
-#include <linux/netfilter_ipv4/ipt_realm.h>
-#include <linux/netfilter_ipv4/ip_tables.h>
+#include <linux/netfilter_ipv4.h>
+#include <linux/netfilter/xt_realm.h>
+#include <linux/netfilter/x_tables.h>
 
 MODULE_AUTHOR("Sampsa Ranta <sampsa@netsonic.fi>");
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("iptables realm match");
+MODULE_DESCRIPTION("X_tables realm match");
+MODULE_ALIAS("ipt_realm");
 
 static int
 match(const struct sk_buff *skb,
@@ -27,16 +29,17 @@ match(const struct sk_buff *skb,
       const struct net_device *out,
       const void *matchinfo,
       int offset,
+      unsigned int protoff,
       int *hotdrop)
 {
-       const struct ipt_realm_info *info = matchinfo;
+       const struct xt_realm_info *info = matchinfo;
        struct dst_entry *dst = skb->dst;
     
        return (info->id == (dst->tclassid & info->mask)) ^ info->invert;
 }
 
 static int check(const char *tablename,
-                 const struct ipt_ip *ip,
+                 const void *ip,
                  void *matchinfo,
                  unsigned int matchsize,
                  unsigned int hook_mask)
@@ -44,18 +47,18 @@ static int check(const char *tablename,
        if (hook_mask
            & ~((1 << NF_IP_POST_ROUTING) | (1 << NF_IP_FORWARD) |
                (1 << NF_IP_LOCAL_OUT) | (1 << NF_IP_LOCAL_IN))) {
-               printk("ipt_realm: only valid for POST_ROUTING, LOCAL_OUT, "
+               printk("xt_realm: only valid for POST_ROUTING, LOCAL_OUT, "
                       "LOCAL_IN or FORWARD.\n");
                return 0;
        }
-       if (matchsize != IPT_ALIGN(sizeof(struct ipt_realm_info))) {
-               printk("ipt_realm: invalid matchsize.\n");
+       if (matchsize != XT_ALIGN(sizeof(struct xt_realm_info))) {
+               printk("xt_realm: invalid matchsize.\n");
                return 0;
        }
        return 1;
 }
 
-static struct ipt_match realm_match = {
+static struct xt_match realm_match = {
        .name           = "realm",
        .match          = match, 
        .checkentry     = check,
@@ -64,12 +67,12 @@ static struct ipt_match realm_match = {
 
 static int __init init(void)
 {
-       return ipt_register_match(&realm_match);
+       return xt_register_match(AF_INET, &realm_match);
 }
 
 static void __exit fini(void)
 {
-       ipt_unregister_match(&realm_match);
+       xt_unregister_match(AF_INET, &realm_match);
 }
 
 module_init(init);