openswan: fix build against Linux v3.7.3
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 21 Jan 2013 13:18:10 +0000 (13:18 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 21 Jan 2013 13:18:10 +0000 (13:18 +0000)
SVN-Revision: 35266

net/openswan/Makefile
net/openswan/patches/100-cross_compile.patch
net/openswan/patches/120-no_manpages.patch
net/openswan/patches/150-linux-3.7-kuid-compat.patch [new file with mode: 0644]

index 78c45898ab5f2e20e221f6c1553405bd7146d047..b71ec18dedd54d0997b4ff706c5d5d9c327c2b85 100644 (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) \
index 63085d0c3159db4572133584c560d00dbd2b05a5..87783ce6ea400c7410709365e9581cbe78bd86ed 100644 (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}
  
index 3cac7ce79c0e2cdefff794742d1f715ece198acb..ea3e1c66a410ec1fcc2a78f4a5127a510fd2e2cf 100644 (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
diff --git a/net/openswan/patches/150-linux-3.7-kuid-compat.patch b/net/openswan/patches/150-linux-3.7-kuid-compat.patch
new file mode 100644 (file)
index 0000000..14d5367
--- /dev/null
@@ -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,