]> git.hungrycats.org Git - linux/commitdiff
[IPSEC]: Move xfrm6 policy code to net/ipv4/xfrm_policy.c
authorDavid S. Miller <davem@nuts.ninka.net>
Wed, 19 Feb 2003 06:32:31 +0000 (22:32 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Wed, 19 Feb 2003 06:32:31 +0000 (22:32 -0800)
net/ipv4/xfrm_policy.c
net/ipv6/Makefile
net/ipv6/xfrm_policy.c [deleted file]

index 9d015cbbab947bfa2b5e8c3d2ac71c697a20af85..02d7ce7797c5a0a2a2ca7ca02fe6481105f3b13e 100644 (file)
@@ -1,3 +1,4 @@
+#include <linux/config.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
 
@@ -198,6 +199,49 @@ struct xfrm_type *xfrm_get_type(u8 proto)
        return type;
 }
 
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+static struct xfrm_type *xfrm6_type_map[256];
+static rwlock_t xfrm6_type_lock = RW_LOCK_UNLOCKED;
+
+int xfrm6_register_type(struct xfrm_type *type)
+{
+       int err = 0;
+
+       write_lock(&xfrm6_type_lock);
+       if (xfrm6_type_map[type->proto] == NULL)
+               xfrm6_type_map[type->proto] = type;
+       else
+               err = -EEXIST;
+       write_unlock(&xfrm6_type_lock);
+       return err;
+}
+
+int xfrm6_unregister_type(struct xfrm_type *type)
+{
+       int err = 0;
+
+       write_lock(&xfrm6_type_lock);
+       if (xfrm6_type_map[type->proto] != type)
+               err = -ENOENT;
+       else
+               xfrm6_type_map[type->proto] = NULL;
+       write_unlock(&xfrm6_type_lock);
+       return err;
+}
+
+struct xfrm_type *xfrm6_get_type(u8 proto)
+{
+       struct xfrm_type *type;
+
+       read_lock(&xfrm6_type_lock);
+       type = xfrm6_type_map[proto];
+       if (type && !try_module_get(type->owner))
+               type = NULL;
+       read_unlock(&xfrm6_type_lock);
+       return type;
+}
+#endif /* CONFIG_IPV6 || CONFIG_IPV6_MODULE */
+
 void xfrm_put_type(struct xfrm_type *type)
 {
        module_put(type->owner);
index 373dbcef9d2c40d301c48ba619362646a3ad70f5..db0614ef8156d3fc93a19cc997bf4af9a162ff4d 100644 (file)
@@ -11,5 +11,3 @@ ipv6-objs :=  af_inet6.o ip6_output.o ip6_input.o addrconf.o sit.o \
                ip6_flowlabel.o ipv6_syms.o
 
 obj-$(CONFIG_NETFILTER)        += netfilter/
-
-obj-y += xfrm_policy.o
diff --git a/net/ipv6/xfrm_policy.c b/net/ipv6/xfrm_policy.c
deleted file mode 100644 (file)
index 208f6aa..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <net/xfrm.h>
-#include <net/ip.h>
-
-static struct xfrm_type *xfrm6_type_map[256];
-static rwlock_t xfrm6_type_lock = RW_LOCK_UNLOCKED;
-
-int xfrm6_register_type(struct xfrm_type *type)
-{
-       int err = 0;
-
-       write_lock(&xfrm6_type_lock);
-       if (xfrm6_type_map[type->proto] == NULL)
-               xfrm6_type_map[type->proto] = type;
-       else
-               err = -EEXIST;
-       write_unlock(&xfrm6_type_lock);
-       return err;
-}
-
-int xfrm6_unregister_type(struct xfrm_type *type)
-{
-       int err = 0;
-
-       write_lock(&xfrm6_type_lock);
-       if (xfrm6_type_map[type->proto] != type)
-               err = -ENOENT;
-       else
-               xfrm6_type_map[type->proto] = NULL;
-       write_unlock(&xfrm6_type_lock);
-       return err;
-}
-
-struct xfrm_type *xfrm6_get_type(u8 proto)
-{
-       struct xfrm_type *type;
-
-       read_lock(&xfrm6_type_lock);
-       type = xfrm6_type_map[proto];
-       if (type && !try_module_get(type->owner))
-               type = NULL;
-       read_unlock(&xfrm6_type_lock);
-       return type;
-}