openswan: fix build against Linux v3.7.3

git-svn-id: svn://svn.openwrt.org/openwrt/packages@35266 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2013-01-21 13:18:10 +00:00
parent f691ab2a68
commit 5f89a754ef
4 changed files with 51 additions and 14 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2012 OpenWrt.org
# Copyright (C) 2006-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=openswan
PKG_VERSION:=2.6.38
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.openswan.org/download
@ -57,7 +57,7 @@ $(call Package/openswan/Default/description)
This package contains the Openswan kernel module.
endef
TARGET_CPPFLAGS += -I$(LINUX_DIR)/include -D__EXPORTED_HEADERS__
TARGET_CPPFLAGS += -I$(LINUX_DIR)/$(LINUX_UAPI_DIR)include -D__EXPORTED_HEADERS__
OPENSWAN_MAKEFLAGS:= \
-C $(PKG_BUILD_DIR) \

View File

@ -1,8 +1,6 @@
Index: openswan-2.6.38/programs/pluto/Makefile
===================================================================
--- openswan-2.6.38.orig/programs/pluto/Makefile 2012-03-23 22:33:43.000000000 +0100
+++ openswan-2.6.38/programs/pluto/Makefile 2012-08-14 15:17:29.000000000 +0200
@@ -58,10 +58,6 @@
--- a/programs/pluto/Makefile
+++ b/programs/pluto/Makefile
@@ -58,10 +58,6 @@ CFLAGS+=-DALLOW_MICROSOFT_BAD_PROPOSAL
ALLFLAGS = $(CPPFLAGS) $(CFLAGS) ${CROSSFLAGS}
@ -13,11 +11,9 @@ Index: openswan-2.6.38/programs/pluto/Makefile
LIBSADNS = $(OPENSWANLIB)
LIBSADNS += -lresolv # -lefence
Index: openswan-2.6.38/programs/Makefile.program
===================================================================
--- openswan-2.6.38.orig/programs/Makefile.program 2012-08-14 15:17:32.000000000 +0200
+++ openswan-2.6.38/programs/Makefile.program 2012-08-14 15:17:38.000000000 +0200
@@ -55,10 +55,6 @@
--- a/programs/Makefile.program
+++ b/programs/Makefile.program
@@ -55,10 +55,6 @@ endif
CFLAGS+= ${WERROR}

View File

@ -22,7 +22,7 @@
-
--- a/programs/pluto/Makefile
+++ b/programs/pluto/Makefile
@@ -196,35 +196,11 @@ doinstall: all
@@ -192,35 +192,11 @@ doinstall: all
$(INSTALL) $(INSTBINFLAGS) $(BINNAMEPLUTO) $(BINNAMEWHACK) $(LIBEXECDIR)
#$(INSTALL) $(INSTSUIDFLAGS) $(BINNAMEWHACKINIT) $(LIBEXECDIR)
if $(USE_ADNS) ; then $(INSTALL) $(INSTBINFLAGS) $(BINNAMEADNS) $(LIBEXECDIR) ; fi

View File

@ -0,0 +1,41 @@
--- a/linux/net/ipsec/pfkey_v2.c
+++ b/linux/net/ipsec/pfkey_v2.c
@@ -738,7 +738,7 @@ pfkey_create(struct socket *sock, int pr
sk->sk_family = PF_KEY;
/* sk->num = protocol; */
sk->sk_protocol = protocol;
- key_pid(sk) = current_uid();
+ key_pid(sk) = IPSEC_FROM_KUIDT(current_uid());
#ifdef HAVE_SOCKET_WQ
KLIPS_PRINT(debug_pfkey,
--- a/linux/include/openswan/ipsec_kversion.h
+++ b/linux/include/openswan/ipsec_kversion.h
@@ -614,6 +614,16 @@
# define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
#endif
+/*
+ * kuid_t <=> uint32_t conversion
+ */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+# define IPSEC_FROM_KUIDT(x) from_kuid(current_user_ns(), x)
+#else
+# define IPSEC_FROM_KUIDT(x) (x)
+#endif
+
#endif /* _OPENSWAN_KVERSIONS_H */
--- a/linux/net/ipsec/pfkey_v2_parser.c
+++ b/linux/net/ipsec/pfkey_v2_parser.c
@@ -1481,7 +1481,7 @@ pfkey_register_reply(int satype, struct
satype,
0,
sadb_msg? sadb_msg->sadb_msg_seq : ++pfkey_msg_seq,
- sadb_msg? sadb_msg->sadb_msg_pid: current_uid()),
+ sadb_msg? sadb_msg->sadb_msg_pid: IPSEC_FROM_KUIDT(current_uid())),
extensions_reply) &&
(alg_num_a ? pfkey_safe_build(error = pfkey_supported_build(&extensions_reply[K_SADB_EXT_SUPPORTED_AUTH],
K_SADB_EXT_SUPPORTED_AUTH,