From 2f52522a6e6f4eb5390f40f2011039849c8b908d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20B=C3=BCsch?= Date: Sat, 9 Oct 2010 08:43:44 +0000 Subject: [PATCH] openswan: Fix compile on linux-2.6.36 SVN-Revision: 23353 --- net/openswan/Makefile | 22 ++++--- net/openswan/patches/110-scripts.patch | 18 ++++-- .../patches/130-compat_net_dev_ops.patch | 10 +++- net/openswan/patches/131-klips_2_6_35.patch | 46 --------------- net/openswan/patches/200-linux-2.6.36.patch | 58 +++++++++++++++++++ 5 files changed, 92 insertions(+), 62 deletions(-) delete mode 100644 net/openswan/patches/131-klips_2_6_35.patch create mode 100644 net/openswan/patches/200-linux-2.6.36.patch diff --git a/net/openswan/Makefile b/net/openswan/Makefile index 8a9c2457e..45beb33c6 100644 --- a/net/openswan/Makefile +++ b/net/openswan/Makefile @@ -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. # See /LICENSE for more information. @@ -9,12 +9,15 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=openswan -PKG_VERSION:=2.6.28 +PKG_VERSION:=2.6.29 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 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 @@ -54,9 +57,10 @@ $(call Package/openswan/Default/description) This package contains the Openswan kernel module. 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) \ LINUX_RELEASE="$(LINUX_RELEASE)" \ KERNELSRC="$(LINUX_DIR)" \ @@ -71,8 +75,12 @@ OPENSWAN_MAKE := $(MAKE) -C $(PKG_BUILD_DIR) \ DESTDIR="$(PKG_INSTALL_DIR)" define Build/Compile - $(OPENSWAN_MAKE) \ - programs module install + $(MAKE) $(PKG_JOBS) $(OPENSWAN_MAKEFLAGS) programs + $(MAKE) $(PKG_JOBS) $(OPENSWAN_MAKEFLAGS) module +endef + +define Build/Install + $(MAKE) $(OPENSWAN_MAKEFLAGS) install endef define Package/openswan/install diff --git a/net/openswan/patches/110-scripts.patch b/net/openswan/patches/110-scripts.patch index d23ca12c5..eafbd9926 100644 --- a/net/openswan/patches/110-scripts.patch +++ b/net/openswan/patches/110-scripts.patch @@ -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 -+++ b/programs/loggerfix ++++ openswan-2.6.29/programs/loggerfix @@ -0,0 +1,5 @@ +#!/bin/sh +# use filename instead of /dev/null to log, but dont log to flash or ram +# pref. log to nfs mount +echo "$*" >> /dev/null +exit 0 ---- a/programs/_plutorun/_plutorun.in -+++ b/programs/_plutorun/_plutorun.in +--- openswan-2.6.29.orig/programs/_plutorun/_plutorun.in ++++ openswan-2.6.29/programs/_plutorun/_plutorun.in @@ -155,7 +155,7 @@ then exit 1 fi @@ -17,9 +23,9 @@ then echo Cannot write to directory to create \"$stderrlog\". exit 1 ---- a/programs/_realsetup/_realsetup.in -+++ b/programs/_realsetup/_realsetup.in -@@ -283,7 +283,7 @@ case "$1" in +--- openswan-2.6.29.orig/programs/_realsetup/_realsetup.in ++++ openswan-2.6.29/programs/_realsetup/_realsetup.in +@@ -290,7 +290,7 @@ case "$1" in # misc pre-Pluto setup diff --git a/net/openswan/patches/130-compat_net_dev_ops.patch b/net/openswan/patches/130-compat_net_dev_ops.patch index e87b955df..2640080af 100644 --- a/net/openswan/patches/130-compat_net_dev_ops.patch +++ b/net/openswan/patches/130-compat_net_dev_ops.patch @@ -1,6 +1,10 @@ ---- a/linux/include/openswan/ipsec_kversion.h -+++ b/linux/include/openswan/ipsec_kversion.h -@@ -363,6 +363,12 @@ +--- + linux/include/openswan/ipsec_kversion.h | 6 ++++++ + 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 diff --git a/net/openswan/patches/131-klips_2_6_35.patch b/net/openswan/patches/131-klips_2_6_35.patch deleted file mode 100644 index 9dc00e4f7..000000000 --- a/net/openswan/patches/131-klips_2_6_35.patch +++ /dev/null @@ -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) diff --git a/net/openswan/patches/200-linux-2.6.36.patch b/net/openswan/patches/200-linux-2.6.36.patch new file mode 100644 index 000000000..d33e102fd --- /dev/null +++ b/net/openswan/patches/200-linux-2.6.36.patch @@ -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) { -- 2.30.2