openswan: Fix compile on linux-2.6.36

git-svn-id: svn://svn.openwrt.org/openwrt/packages@23353 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
mb 2010-10-09 08:43:44 +00:00
parent 1176f04e7c
commit 08ba2ab5a8
5 changed files with 92 additions and 62 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2006-2009 OpenWrt.org # Copyright (C) 2006-2010 OpenWrt.org
# #
# This is free software, licensed under the GNU General Public License v2. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -9,12 +9,15 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=openswan PKG_NAME:=openswan
PKG_VERSION:=2.6.28 PKG_VERSION:=2.6.29
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.openswan.org/download PKG_SOURCE_URL:=http://www.openswan.org/download
PKG_MD5SUM:=37f2ad2664dd89e6ad96ae82f6378166 PKG_MD5SUM:=cd6c127585ec6db63780e9a40d5387fb
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -54,9 +57,10 @@ $(call Package/openswan/Default/description)
This package contains the Openswan kernel module. This package contains the Openswan kernel module.
endef endef
TARGET_CPPFLAGS += -I$(LINUX_DIR)/include TARGET_CPPFLAGS += -I$(LINUX_DIR)/include -D__EXPORTED_HEADERS__
OPENSWAN_MAKE := $(MAKE) -C $(PKG_BUILD_DIR) \ OPENSWAN_MAKEFLAGS:= \
-C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \ $(TARGET_CONFIGURE_OPTS) \
LINUX_RELEASE="$(LINUX_RELEASE)" \ LINUX_RELEASE="$(LINUX_RELEASE)" \
KERNELSRC="$(LINUX_DIR)" \ KERNELSRC="$(LINUX_DIR)" \
@ -71,8 +75,12 @@ OPENSWAN_MAKE := $(MAKE) -C $(PKG_BUILD_DIR) \
DESTDIR="$(PKG_INSTALL_DIR)" DESTDIR="$(PKG_INSTALL_DIR)"
define Build/Compile define Build/Compile
$(OPENSWAN_MAKE) \ $(MAKE) $(PKG_JOBS) $(OPENSWAN_MAKEFLAGS) programs
programs module install $(MAKE) $(PKG_JOBS) $(OPENSWAN_MAKEFLAGS) module
endef
define Build/Install
$(MAKE) $(OPENSWAN_MAKEFLAGS) install
endef endef
define Package/openswan/install define Package/openswan/install

View File

@ -1,13 +1,19 @@
---
programs/_plutorun/_plutorun.in | 2 +-
programs/_realsetup/_realsetup.in | 2 +-
programs/loggerfix | 5 +++++
3 files changed, 7 insertions(+), 2 deletions(-)
--- /dev/null --- /dev/null
+++ b/programs/loggerfix +++ openswan-2.6.29/programs/loggerfix
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
+#!/bin/sh +#!/bin/sh
+# use filename instead of /dev/null to log, but dont log to flash or ram +# use filename instead of /dev/null to log, but dont log to flash or ram
+# pref. log to nfs mount +# pref. log to nfs mount
+echo "$*" >> /dev/null +echo "$*" >> /dev/null
+exit 0 +exit 0
--- a/programs/_plutorun/_plutorun.in --- openswan-2.6.29.orig/programs/_plutorun/_plutorun.in
+++ b/programs/_plutorun/_plutorun.in +++ openswan-2.6.29/programs/_plutorun/_plutorun.in
@@ -155,7 +155,7 @@ then @@ -155,7 +155,7 @@ then
exit 1 exit 1
fi fi
@ -17,9 +23,9 @@
then then
echo Cannot write to directory to create \"$stderrlog\". echo Cannot write to directory to create \"$stderrlog\".
exit 1 exit 1
--- a/programs/_realsetup/_realsetup.in --- openswan-2.6.29.orig/programs/_realsetup/_realsetup.in
+++ b/programs/_realsetup/_realsetup.in +++ openswan-2.6.29/programs/_realsetup/_realsetup.in
@@ -283,7 +283,7 @@ case "$1" in @@ -290,7 +290,7 @@ case "$1" in
# misc pre-Pluto setup # misc pre-Pluto setup

View File

@ -1,6 +1,10 @@
--- a/linux/include/openswan/ipsec_kversion.h ---
+++ b/linux/include/openswan/ipsec_kversion.h linux/include/openswan/ipsec_kversion.h | 6 ++++++
@@ -363,6 +363,12 @@ 1 file changed, 6 insertions(+)
--- openswan-2.6.29.orig/linux/include/openswan/ipsec_kversion.h
+++ openswan-2.6.29/linux/include/openswan/ipsec_kversion.h
@@ -366,6 +366,12 @@
#endif #endif
#endif #endif

View File

@ -1,46 +0,0 @@
--- a/linux/net/ipsec/pfkey_v2.c
+++ b/linux/net/ipsec/pfkey_v2.c
@@ -720,11 +720,20 @@ pfkey_create(struct socket *sock, int pr
/* sk->num = protocol; */
sk->sk_protocol = protocol;
key_pid(sk) = current_uid();
+
+#ifdef HAVE_SOCKET_WQ
+ KLIPS_PRINT(debug_pfkey,
+ "klips_debug:pfkey_create: "
+ "sock->wq->fasync_list=0p%p sk_sleep(sk)=0p%p.\n",
+ sock->wq->fasync_list,
+ sk_sleep(sk));
+#else
KLIPS_PRINT(debug_pfkey,
"klips_debug:pfkey_create: "
"sock->fasync_list=0p%p sk->sleep=0p%p.\n",
sock->fasync_list,
sk->sk_sleep);
+#endif
pfkey_insert_socket(sk);
pfkey_list_insert_socket(sock, &pfkey_open_sockets);
@@ -1157,7 +1166,9 @@ pfkey_get_info(char *buffer, char **star
sk,
key_pid(sk),
sock_flag(sk, SOCK_DEAD),
+#ifndef HAVE_SOCKET_WQ
sk->sk_sleep,
+#endif
sk->sk_socket,
sk->sk_err,
sk->sk_reuse,
--- a/linux/include/openswan/ipsec_kversion.h
+++ b/linux/include/openswan/ipsec_kversion.h
@@ -506,6 +506,10 @@
#define CTL_NAME(n) .ctl_name = n,
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+#define HAVE_SOCKET_WQ
+#endif
+
#if __KERNEL__
# if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0)
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)

View File

@ -0,0 +1,58 @@
---
linux/net/ipsec/ipsec_xmit.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
--- openswan-2.6.29.orig/linux/net/ipsec/ipsec_xmit.c
+++ openswan-2.6.29/linux/net/ipsec/ipsec_xmit.c
@@ -105,6 +105,15 @@ static __u32 zeroes[64];
int ipsec_xmit_trap_count = 0;
int ipsec_xmit_trap_sendcount = 0;
+#ifndef NIPQUAD
+#define NIPQUAD(addr) \
+ ((unsigned char *)&addr)[0], \
+ ((unsigned char *)&addr)[1], \
+ ((unsigned char *)&addr)[2], \
+ ((unsigned char *)&addr)[3]
+#define NIPQUAD_FMT "%u.%u.%u.%u"
+#endif
+
#define dmp(_x,_y,_z) if(debug_xmit && sysctl_ipsec_debug_verbose) ipsec_dmp_block(_x,_y,_z)
#if !defined(SKB_COPY_EXPAND) || defined(KLIPS_UNIT_TESTS)
@@ -2085,7 +2094,11 @@ ipsec_xmit_send(struct ipsec_xmit_state*
return IPSEC_XMIT_ROUTEERR;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+ if(ixs->dev == ixs->route->dst.dev) {
+#else
if(ixs->dev == ixs->route->u.dst.dev) {
+#endif
ip_rt_put(ixs->route);
/* This is recursion, drop it. */
if (ixs->stats)
@@ -2098,7 +2111,11 @@ ipsec_xmit_send(struct ipsec_xmit_state*
}
skb_dst_drop(ixs->skb);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+ skb_dst_set(ixs->skb, &ixs->route->dst);
+#else
skb_dst_set(ixs->skb, &ixs->route->u.dst);
+#endif
if(ixs->stats) {
ixs->stats->tx_bytes += ixs->skb->len;
}
@@ -2139,7 +2156,11 @@ ipsec_xmit_send(struct ipsec_xmit_state*
else
err = NF_HOOK(PF_INET, OSW_NF_INET_LOCAL_OUT, ixs->skb, NULL,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+ ixs->route->dst.dev,
+#else
ixs->route->u.dst.dev,
+#endif
ipsec_xmit_send2);
if(err != NET_XMIT_SUCCESS && err != NET_XMIT_CN) {