--=_courier-15342-1045361020-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
>Well, the kernel doesn't link for me when IPV6 is compiled as a module (config
>below) -- linking IPv6 in is fine.
Here is a fix for xfrm6_get_type() link problem when IPv6 is
configured as a module.
--=_courier-15342-1045361020-0001-2
Content-Type: application/octet-stream; type=patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="xfrm6_get_type.diff"
diff -ruN linux-2.5.61.orig/net/ipv4/xfrm_policy.c linux-2.5.61/net/ipv4/xfrm_policy.c
--- linux-2.5.61.orig/net/ipv4/xfrm_policy.c	2003-02-14 15:51:45.000000000 -0800
+++ linux-2.5.61/net/ipv4/xfrm_policy.c	2003-02-15 16:11:43.000000000 -0800
@@ -1228,3 +1228,48 @@
 	xfrm_state_init();
 	xfrm_input_init();
 }
+
+#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
diff -ruN linux-2.5.61.orig/net/ipv6/Makefile linux-2.5.61/net/ipv6/Makefile
--- linux-2.5.61.orig/net/ipv6/Makefile	2003-02-14 15:52:25.000000000 -0800
+++ linux-2.5.61/net/ipv6/Makefile	2003-02-15 16:10:13.000000000 -0800
@@ -11,5 +11,3 @@
 		ip6_flowlabel.o ipv6_syms.o
 
 obj-$(CONFIG_NETFILTER)	+= netfilter/
-
-obj-y += xfrm_policy.o
diff -ruN linux-2.5.61.orig/net/ipv6/ipv6_syms.c linux-2.5.61/net/ipv6/ipv6_syms.c
--- linux-2.5.61.orig/net/ipv6/ipv6_syms.c	2003-02-14 15:52:09.000000000 -0800
+++ linux-2.5.61/net/ipv6/ipv6_syms.c	2003-02-15 16:10:24.000000000 -0800
@@ -26,6 +26,3 @@
 EXPORT_SYMBOL(inet6_ioctl);
 EXPORT_SYMBOL(ipv6_get_saddr);
 EXPORT_SYMBOL(ipv6_chk_addr);
-EXPORT_SYMBOL(xfrm6_register_type);
-EXPORT_SYMBOL(xfrm6_unregister_type);
-EXPORT_SYMBOL(xfrm6_get_type);
diff -ruN linux-2.5.61.orig/net/ipv6/xfrm_policy.c linux-2.5.61/net/ipv6/xfrm_policy.c
--- linux-2.5.61.orig/net/ipv6/xfrm_policy.c	2003-02-14 15:52:25.000000000 -0800
+++ linux-2.5.61/net/ipv6/xfrm_policy.c	1969-12-31 16:00:00.000000000 -0800
@@ -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;
-}
diff -ruN linux-2.5.61.orig/net/netsyms.c linux-2.5.61/net/netsyms.c
--- linux-2.5.61.orig/net/netsyms.c	2003-02-14 15:51:31.000000000 -0800
+++ linux-2.5.61/net/netsyms.c	2003-02-15 16:10:46.000000000 -0800
@@ -328,6 +328,9 @@
 EXPORT_SYMBOL(xfrm6_state_lookup);
 EXPORT_SYMBOL(xfrm6_find_acq);
 EXPORT_SYMBOL(xfrm6_alloc_spi);
+EXPORT_SYMBOL(xfrm6_register_type);
+EXPORT_SYMBOL(xfrm6_unregister_type);
+EXPORT_SYMBOL(xfrm6_get_type);
 #endif
 
 EXPORT_SYMBOL_GPL(xfrm_probe_algs);
--=_courier-15342-1045361020-0001-2--