Tuesday, July 17, 2007

Compiling Cisco vpnclient-linux-x86_64-4.8 on Fedora Core 6 x86_64 kernel 2.6.18/2.6.19

Thanks a lot to Amit who found the following solution ( http://blog.360.yahoo.com/blog-.WURHFYwdq8.zfEosWC6j8jQ?p=55 )

Unfortunately the cisco vpnclient-linux-x86_64-4.8 will not compile with the kernel (2.6.18) which comes with fedora core 6 or 2.6.19(latest stable from http://kernel.org) both x86 and x86_64 .

<u> <b>Error(s) you get while compiling</b></u>

#./vpn_install
Cisco Systems VPN Client Version 4.8.00 (0490) Linux Installer
Copyright (C) 1998-2005 Cisco Systems, Inc. All Rights Reserved.
By installing this product you agree that you have read the
license.txt file (The VPN Client license) and will comply with
its terms.
Directory where binaries will be installed [/usr/local/bin]
Automatically start the VPN service at boot time [yes]
In order to build the VPN kernel module, you must have the
kernel headers for the version of the kernel you are running.
Directory containing linux kernel source code [/lib/modules/2.6.19-1.meaks/build]
* Binaries will be installed in "/usr/local/bin".
* Modules will be installed in "/lib/modules/2.6.19-1.meaks/CiscoVPN".
* The VPN service will be started AUTOMATICALLY at boot time.
* Kernel source from "/lib/modules/2.6.19-1.meaks/build" will be used to build the module.
Is the above correct [y]
Making module
make -C /lib/modules/2.6.19-1.meaks/build SUBDIRS=/home/amitkr/setups/vpnclient modules
make[1]: Entering directory `/home/amitkr/kernel/linux-2.6.19-1.meaks/build'
make[1]: Warning: File `Makefile' has modification time 1e+04 s in the future
make -C /home/amitkr/kernel/linux-2.6.19-1.meaks O=/home/amitkr/kernel/linux-2.6.19-1.meaks/build modules
CC [M] /home/amitkr/setups/vpnclient/interceptor.o
In file included from /home/amitkr/setups/vpnclient/Cniapi.h:15,
from /home/amitkr/setups/vpnclient/interceptor.c:30:
/home/amitkr/setups/vpnclient/GenDefs.h:110:2: warning: #warning 64 bit
/home/amitkr/setups/vpnclient/interceptor.c: In function handle_vpnup:
/home/amitkr/setups/vpnclient/interceptor.c:310: warning: assignment from incompatible pointer type
/home/amitkr/setups/vpnclient/interceptor.c:334: warning: assignment from incompatible pointer type
/home/amitkr/setups/vpnclient/interceptor.c:335: warning: assignment from incompatible pointer type
/home/amitkr/setups/vpnclient/interceptor.c: In function do_cleanup:
/home/amitkr/setups/vpnclient/interceptor.c:378: warning: assignment from incompatible pointer type
/home/amitkr/setups/vpnclient/interceptor.c: In function recv_ip_packet_handler:
/home/amitkr/setups/vpnclient/interceptor.c:553: error: CHECKSUM_HW undeclared (first use in this function)
/home/amitkr/setups/vpnclient/interceptor.c:553: error: (Each undeclared identifier is reported only once
/home/amitkr/setups/vpnclient/interceptor.c:553: error: for each function it appears in.)
/home/amitkr/setups/vpnclient/interceptor.c:557: error: too many arguments to function skb_checksum_help
/home/amitkr/setups/vpnclient/interceptor.c: In function do_cni_send:
/home/amitkr/setups/vpnclient/interceptor.c:680: error: CHECKSUM_HW undeclared (first use in this function)
/home/amitkr/setups/vpnclient/interceptor.c:683: error: too many arguments to function skb_checksum_help
make[4]: *** [/home/amitkr/setups/vpnclient/interceptor.o] Error 1
make[3]: *** [_module_/home/amitkr/setups/vpnclient] Error 2
make[2]: *** [modules] Error 2
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/home/amitkr/kernel/linux-2.6.19-1.meaks/build'
make: *** [default] Error 2
Failed to make module "cisco_ipsec.ko".


<b> <u> What is the Problem ?</u></b>


This is because of
[1]
no more exists with, which used to be present in ${KSRCPATH}/build/include/linux/config.h with old kernels, after doing a make O=build menuconfig

[2]
For kernel 2.6.19 things are even worse, the CHECKSUM_HW macro does not exists any more in

[3]
the function skb_checksum_help(skb) declared in file and defined in file has been changed to take only a single argument.

<b> <u>Solution</u></b>

So, to compile the cisco vpn 4.8 x86_64 you need to:
[1] make a symlink to autoconfig.h as config.h
$ cd ${KSRCPATH}/build/include/linux
$ ln -s autoconfig.h config.h
This will solve the first problem

[2] the macro CHECKSUM_HW needs to be replaced with CHECKSUM_COMPLETE in the file ${VPNCLIENT}/interceptor.c

[3] edit the files calling skb_checksum_help() , look for the proper LINUX_VERSION_CODE macro that matches your kernel version(2.6.19) and remove the second argument from skb_checksum_help() so that the function looks like skb_checksum_help(skb).
The macro looks something like this

KERNEL_VERSION(2,6,10)

You can find the changes in concurrent releases of kernel in kernel ChangeLog<b></b>