static int __init ah4_init(void)
314 {
315 if (xfrm_register_type(&ah_type, AF_INET) < 0) {
316 printk(KERN_INFO "ip ah init: can't add xfrm type\n");
317 return -EAGAIN;
318 }
319 if (inet_add_protocol(&ah4_protocol, IPPROTO_AH) < 0) {
320 printk(KERN_INFO "ip ah init: can't add protocol\n");
321 xfrm_unregister_type(&ah_type, AF_INET);
322 return -EAGAIN;
323 }
324 return 0;
325 }
Robin Battey: As I've mentioned elsewhere, you can't actually do that because of the CONFIG_XFRM option which must be "y", not compiled as a module.
$ grep XFRM ./linux/linux-2.6/config_base
[COLOR="Red"]CONFIG_XFRM=y
CONFIG_XFRM_USER=y[/COLOR]
# CONFIG_INET_XFRM_TUNNEL is not set
CONFIG_INET_XFRM_MODE_TRANSPORT=y
CONFIG_INET_XFRM_MODE_TUNNEL=y
CONFIG_INET_XFRM_MODE_BEET=y
# CONFIG_INET6_XFRM_TUNNEL is not set
CONFIG_INET6_XFRM_MODE_TRANSPORT=y
CONFIG_INET6_XFRM_MODE_TUNNEL=y
CONFIG_INET6_XFRM_MODE_BEET=y
# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
$ grep XFRM make.log
[COLOR="Red"]Transformation user configuration interface (XFRM_USER) [Y/n/m/?] y[/COLOR]
Transformation sub policy support (EXPERIMENTAL) (XFRM_SUB_POLICY) [N/y/?] (NEW)
Transformation migrate database (EXPERIMENTAL) (XFRM_MIGRATE) [N/y/?] (NEW)
PF_KEY sockets (NET_KEY) [Y/n/m/?] y
IP: IPsec transport mode (INET_XFRM_MODE_TRANSPORT) [Y/n/m/?] y
IP: IPsec tunnel mode (INET_XFRM_MODE_TUNNEL) [Y/n/m/?] y
IP: IPsec BEET mode (INET_XFRM_MODE_BEET) [Y/n/m/?] y
IPv6: IPsec transport mode (INET6_XFRM_MODE_TRANSPORT) [Y/n/m/?] y
IPv6: IPsec tunnel mode (INET6_XFRM_MODE_TUNNEL) [Y/n/m/?] y
IPv6: IPsec BEET mode (INET6_XFRM_MODE_BEET) [Y/n/m/?] y
IPv6: MIPv6 route optimization mode (EXPERIMENTAL) (INET6_XFRM_MODE_ROUTEOPTIMIZATION) [N/m/y/?] n
Yes I have seen that link before and I can confirm that the required modules have been set to =y in config_base, but here is the interesting thing:
Both of the following two configuration items are supposed to exist for compiling Linux kernel:
CONFIG_XFRM and CONFIG_XFRM_USER
http://cateee.net/lkddb/web-lkddb/XFRM.html
http://cateee.net/lkddb/web-lkddb/XFRM_USER.html
In particular, CONFIG_XFRM is very important as everything I've read says that it must be set to =y to run IPsec.
Ref: http://www.linksysinfo.org/index.php?threads/tomato-and-ipsec-why-not.38344/
Now I know that I set both to =y in config_base.
Code:$ grep XFRM ./linux/linux-2.6/config_base [COLOR="Red"]CONFIG_XFRM=y CONFIG_XFRM_USER=y[/COLOR] # CONFIG_INET_XFRM_TUNNEL is not set CONFIG_INET_XFRM_MODE_TRANSPORT=y CONFIG_INET_XFRM_MODE_TUNNEL=y CONFIG_INET_XFRM_MODE_BEET=y # CONFIG_INET6_XFRM_TUNNEL is not set CONFIG_INET6_XFRM_MODE_TRANSPORT=y CONFIG_INET6_XFRM_MODE_TUNNEL=y CONFIG_INET6_XFRM_MODE_BEET=y # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
But the make log-file makes no mention of CONFIG_XFRM, only CONFIG_XFRM_USER.
Code:$ grep XFRM make.log [COLOR="Red"]Transformation user configuration interface (XFRM_USER) [Y/n/m/?] y[/COLOR] Transformation sub policy support (EXPERIMENTAL) (XFRM_SUB_POLICY) [N/y/?] (NEW) Transformation migrate database (EXPERIMENTAL) (XFRM_MIGRATE) [N/y/?] (NEW) PF_KEY sockets (NET_KEY) [Y/n/m/?] y IP: IPsec transport mode (INET_XFRM_MODE_TRANSPORT) [Y/n/m/?] y IP: IPsec tunnel mode (INET_XFRM_MODE_TUNNEL) [Y/n/m/?] y IP: IPsec BEET mode (INET_XFRM_MODE_BEET) [Y/n/m/?] y IPv6: IPsec transport mode (INET6_XFRM_MODE_TRANSPORT) [Y/n/m/?] y IPv6: IPsec tunnel mode (INET6_XFRM_MODE_TUNNEL) [Y/n/m/?] y IPv6: IPsec BEET mode (INET6_XFRM_MODE_BEET) [Y/n/m/?] y IPv6: MIPv6 route optimization mode (EXPERIMENTAL) (INET6_XFRM_MODE_ROUTEOPTIMIZATION) [N/m/y/?] n
So the question is, is there something wrong with the Makefile that it is not reading CONFIG_XFRM=y from the config_base? Only XFRM_USER can be seen in the log file.
Thank you very much for your continued feedback.
Try issuing a "make cleankernel" before recompiling. Also after done compiling, check if the generated .config file inside linux-2.6/ actually contains your new entries.
# ls -al /lib/modules/2.6.22.19/kernel/net/ipv4
drwxrwxr-x 3 admin root 43 Sep 25 01:08 .
drwxrwxr-x 7 admin root 79 Sep 25 01:09 ..
drwxrwxr-x 2 admin root 598 Sep 25 01:08 netfilter
-rw-rw-r-- 1 admin root 6380 Sep 25 01:08 tcp_vegas.ko
$ diff -u config_base config_base.orig
--- config_base 2013-09-25 00:21:43.879465212 -0500
+++ config_base.orig 2013-09-25 00:31:30.283473800 -0500
@@ -281,13 +281,10 @@
#
# Networking options
#
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=y
-CONFIG_NETFILTER_XT_MATCH_POLICY=y
CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set
CONFIG_UNIX=y
-CONFIG_NET_KEY=y
+# CONFIG_NET_KEY is not set
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
@@ -309,14 +306,14 @@
# CONFIG_IP_PIMSM_V2 is not set
# CONFIG_ARPD is not set
CONFIG_SYN_COOKIES=y
-CONFIG_INET_AH=y
-CONFIG_INET_ESP=y
-CONFIG_INET_IPCOMP=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
# CONFIG_INET_XFRM_TUNNEL is not set
# CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=y
-CONFIG_INET_XFRM_MODE_TUNNEL=y
-CONFIG_INET_XFRM_MODE_BEET=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_DIAG is not set
CONFIG_TCP_CONG_ADVANCED=y
# CONFIG_TCP_CONG_BIC is not set
@@ -340,25 +337,25 @@
CONFIG_DEFAULT_TCP_CONG="reno"
# CONFIG_TCP_MD5SIG is not set
# CONFIG_IP_VS is not set
-CONFIG_IPV6=y
+# CONFIG_IPV6 is not set
# CONFIG_IPV6_PRIVACY is not set
# CONFIG_IPV6_ROUTER_PREF is not set
# CONFIG_IPV6_ROUTE_INFO is not set
# CONFIG_IPV6_OPTIMISTIC_DAD is not set
-CONFIG_INET6_AH=y
-CONFIG_INET6_ESP=y
-CONFIG_INET6_IPCOMP=y
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
# CONFIG_IPV6_MIP6 is not set
# CONFIG_INET6_XFRM_TUNNEL is not set
# CONFIG_INET6_TUNNEL is not set
-CONFIG_INET6_XFRM_MODE_TRANSPORT=y
-CONFIG_INET6_XFRM_MODE_TUNNEL=y
-CONFIG_INET6_XFRM_MODE_BEET=y
+# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET6_XFRM_MODE_BEET is not set
# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
CONFIG_IPV6_SIT=m
CONFIG_IPV6_SIT_6RD=y
# CONFIG_IPV6_TUNNEL is not set
-CONFIG_IPV6_MULTIPLE_TABLES=y
+# CONFIG_IPV6_MULTIPLE_TABLES is not set
# CONFIG_IPV6_SUBTREES is not set
# CONFIG_IPV6_MROUTE is not set
# CONFIG_IPV6_PIMSM_V2 is not set
admin@RT-N16:/tmp/mnt/Entware/share# ipsec start
Starting strongSwan 5.0.4 IPsec [starter]...
insmod: can't insert 'ah4.ko': Resource temporarily unavailable
insmod: can't insert 'esp4.ko': Resource temporarily unavailable
insmod: can't insert 'ipcomp.ko': Resource temporarily unavailable
insmod: can't insert 'xfrm4_tunnel.ko': Resource temporarily unavailable
insmod: can't insert 'xfrm_user.ko': Cannot allocate memory
admin@RT-N16:/tmp/mnt/Entware/share# insmod ah4
insmod: can't insert 'ah4.ko': Resource temporarily unavailable
admin@RT-N16:/tmp/mnt/Entware/share# insmod esp4
insmod: can't insert 'esp4.ko': Resource temporarily unavailable
admin@RT-N16:/tmp/mnt/Entware/share# insmod ipcomp.ko
insmod: can't insert 'ipcomp.ko': Resource temporarily unavailable
admin@RT-N16:/tmp/mnt/Entware/share# insmod xfrm4_tunnel.ko
insmod: can't insert 'xfrm4_tunnel.ko': Resource temporarily unavailable
admin@RT-N16:/tmp/mnt/Entware/share# insmod xfrm_user.ko
insmod: can't insert 'xfrm_user.ko': Cannot allocate memory
ip ah init: can't add xfrm type
ip esp init: can't add xfrm type
ipcomp init: can't add xfrm type
ipip init: can't add xfrm type
Initializing XFRM netlink socket
# lsmod | grep -i tcp_vegas
# insmod /lib/modules/2.6.22.19/kernel/net/ipv4/tcp_vegas.ko
# lsmod | grep -i tcp_vegas
tcp_vegas 3776 0
# rmmod tcp_vegas
# lsmod | grep -i tcp_vegas
$ cd ./linux/linux-2.6/net/ipv4
$ ls -al ah4.c esp4.c ipcomp.c xfrm4_tunnel.c
-rw-rw-r-- 1 vmware vmware 7844 Sep 25 09:41 ah4.c
-rw-rw-r-- 1 vmware vmware 12162 Sep 25 09:41 esp4.c
-rw-rw-r-- 1 vmware vmware 10600 Sep 25 09:41 ipcomp.c
-rw-rw-r-- 1 vmware vmware 2675 Sep 25 09:41 xfrm4_tunnel.c
$ cd ../xfrm
$ ls -al xfrm_user.c
-rw-rw-r-- 1 vmware vmware 59347 Sep 25 00:31 xfrm_user.c
They're not required to. You can use insmod to manually load a module from any path/filename.Kernel modules (.ko files) go in the directory /lib/modules/2.6.22.19/kernel/, for example:
net/ipv6/sit.ko
insmod /path/to/my/module.ko
./crypto/deflate.ko
./crypto/des.ko
./crypto/md5.ko
./lib/zlib_deflate/zlib_deflate.ko
./lib/zlib_inflate/zlib_inflate.ko
./net/ipv4/ah4.ko
./net/ipv4/esp4.ko
./net/ipv4/ipcomp.ko
./net/ipv4/tunnel4.ko
./net/ipv4/xfrm4_mode_beet.ko
./net/ipv4/xfrm4_mode_transport.ko
./net/ipv4/xfrm4_mode_tunnel.ko
./net/ipv4/xfrm4_tunnel.ko
./net/ipv6/ah6.ko
./net/ipv6/esp6.ko
./net/ipv6/ipcomp6.ko
./net/ipv6/tunnel6.ko
./net/ipv6/xfrm6_mode_beet.ko
./net/ipv6/xfrm6_mode_transport.ko
./net/ipv6/xfrm6_mode_tunnel.ko
./net/ipv6/xfrm6_tunnel.ko
./net/xfrm/xfrm_user.ko
insmod: can't insert 'tunnel4.ko': invalid module format
insmod: can't insert 'tunnel6.ko': invalid module format
insmod: can't insert 'zlib_deflate.ko': invalid module format
insmod: can't insert 'zlib_inflate.ko': invalid module format
insmod: can't insert 'xfrm6_tunnel.ko': invalid module format
insmod: can't insert 'ah4.ko': Resource temporarily unavailable
insmod: can't insert 'esp4.ko': Resource temporarily unavailable
insmod: can't insert 'ipcomp.ko': Resource temporarily unavailable
insmod: can't insert 'xfrm4_tunnel.ko': Resource temporarily unavailable
insmod: can't insert 'xfrm_user.ko': Cannot allocate memory
insmod: can't insert 'ah6.ko': Resource temporarily unavailable
insmod: can't insert 'esp6.ko': Resource temporarily unavailable
insmod: can't insert 'ipcomp6.ko': Resource temporarily unavailable
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!