openswan: Fix compile on linux-2.6.36
authorMichael Büsch <mb@bu3sch.de>
Sat, 9 Oct 2010 08:43:44 +0000 (08:43 +0000)
committerMichael Büsch <mb@bu3sch.de>
Sat, 9 Oct 2010 08:43:44 +0000 (08:43 +0000)
SVN-Revision: 23353

net/openswan/Makefile
net/openswan/patches/110-scripts.patch
net/openswan/patches/130-compat_net_dev_ops.patch
net/openswan/patches/131-klips_2_6_35.patch [deleted file]
net/openswan/patches/200-linux-2.6.36.patch [new file with mode: 0644]

index 8a9c245..45beb33 100644 (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.
 # 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
index d23ca12..eafbd99 100644 (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
-+++ 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
  
index e87b955..2640080 100644 (file)
@@ -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 (file)
index 9dc00e4..0000000
+++ /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 (file)
index 0000000..d33e102
--- /dev/null
@@ -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) {