Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sat, 15 Feb 2003 20:49:36 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sat, 15 Feb 2003 20:49:36 -0500 Received: from ip-64-139-11-202.dsl.sca.megapath.net ([64.139.11.202]:10370 "EHLO localhost.localdomain") by vger.kernel.org with ESMTP id ; Sat, 15 Feb 2003 20:49:33 -0500 Date: Sat, 15 Feb 2003 17:58:26 -0800 Message-ID: <87ptptx9z1.wl@ipinfusion.com> From: Kunihiro Ishiguro To: Matthias Andree , rct@gherkin.frus.com CC: Kernel Mailing List Subject: Re: Linux v2.5.61 In-Reply-To: <20030215135345.GA16783@merlin.emma.line.org> References: <20030215135345.GA16783@merlin.emma.line.org> User-Agent: Wanderlust/2.10.0 (Venus) SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.2.92 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: multipart/mixed; boundary="Multipart_Sat_Feb_15_17:58:26_2003-1" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4478 Lines: 153 --Multipart_Sat_Feb_15_17:58:26_2003-1 Content-Type: text/plain; charset=US-ASCII >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. --Multipart_Sat_Feb_15_17:58:26_2003-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="xfrm6_get_type.diff" Content-Transfer-Encoding: 7bit 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 -#include - -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); --Multipart_Sat_Feb_15_17:58:26_2003-1-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/