-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks,

We use Jool in production on our NAT64 gateways and find it more
'complete' than the NAT64 support in OpenBSD.

That said, I recently upgraded our Jool hosts to CentOS 7.2 to find that
the latest version of Jool (3.4.2 at time of writing) will not build
successfully on CentOS 7.2.

A quick check through the bug tracker found this:

https://github.com/NICMx/Jool/issues/105

Unfortunately, this was not the problem that I was seeing but after
reading issue #105 and the corresponding Stack Overflow question asked
by Alberto that was referenced in issue #105, the detail of the question
was sufficient to point me in the right direction to fix my particular
build issues - while working on my patch, it seemed reasonable to fix
the original issue #105 reported in the bug tracker even though it was
not affecting us directly but simply because it was The Right Thing To
Do(tm).

The attached patch applies cleanly to Jool 3.4.2, tries to supplement
the existing kernel version check logic and tries hard not to replace
any such logic except where necessary; my testing has been focused on
CentOS 7.0, 7.1 and 7.2 kernels to ensure that everything builds
correctly on those platforms with no errors or warnings but I have taken
special care to ensure that non-RHEL codepaths have *not* been modified
so any testing should be focused on non-RHEL platforms to ensure the
patch does not cause any regressions.

If the patch is not suitable for inclusion in Jool for whatever reason,
I believe that the code should still serve as a suitable answer to
Alberto's Stack Overflow question.

P.S. Happy New Year to all!

Regards,
Terry
- -- 
Terry Froy
Spilsby Internet Solutions
http://www.spilsby.net/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlaGXUMACgkQpSya/lqjFqCtdgCfZPOwsBw1TXXzG5Mcky0ucudr
Eq4An2pJVB/qDcSDkCDwUPXjj0hozJuC
=D2y0
-----END PGP SIGNATURE-----

diff -Naur a/mod/common/send_packet.c b/mod/common/send_packet.c
--- a/mod/common/send_packet.c	2015-11-20 15:26:28.000000000 +0000
+++ b/mod/common/send_packet.c	2016-01-01 10:21:48.135000000 +0000
@@ -72,6 +72,16 @@
 	}
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
+# define JOOL_SKB_IGNORE_DF
+#else
+# ifdef RHEL_RELEASE_CODE
+#  if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 2)
+#   define JOOL_SKB_IGNORE_DF
+#  endif
+# endif
+#endif
+
+#ifdef JOOL_SKB_IGNORE_DF
 	out->skb->ignore_df = true; /* FFS, kernel. */
 #else
 	out->skb->local_df = true; /* FFS, kernel. */
diff -Naur a/mod/stateful/fragment_db.c b/mod/stateful/fragment_db.c
--- a/mod/stateful/fragment_db.c	2015-11-20 15:26:28.000000000 +0000
+++ b/mod/stateful/fragment_db.c	2016-01-01 10:43:49.385000000 +0000
@@ -71,6 +71,16 @@
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
+# define JOOL_INET6_HASH_FRAG
+#else
+# ifdef RHEL_RELEASE_CODE
+#  if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 2)
+#   define JOOL_INET6_HASH_FRAG
+#  endif
+# endif
+#endif
+
+#ifdef JOOL_INET6_HASH_FRAG
 /**
  * Hash function for IPv6 keys from reassembly.c
  */
diff -Naur a/mod/stateful/nf_hook.c b/mod/stateful/nf_hook.c
--- a/mod/stateful/nf_hook.c	2015-11-20 15:26:28.000000000 +0000
+++ b/mod/stateful/nf_hook.c	2016-01-01 10:21:21.763000000 +0000
@@ -59,18 +59,38 @@
 
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
-#define HOOK_ARG_TYPE const struct nf_hook_ops *
+# define HOOK_ARG_TYPE const struct nf_hook_ops *
 #else
-#define HOOK_ARG_TYPE unsigned int
+# ifdef RHEL_RELEASE_CODE
+#  if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 0)
+#   define HOOK_ARG_TYPE const struct nf_hook_ops *
+#  endif
+# endif
+#endif
+
+#ifndef HOOK_ARG_TYPE
+# define HOOK_ARG_TYPE unsigned int
 #endif
 
 static unsigned int hook_ipv4(HOOK_ARG_TYPE hook, struct sk_buff *skb,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
 		const struct nf_hook_state *state)
-#else
+#elif !defined(RHEL_RELEASE_CODE)
 		const struct net_device *in, const struct net_device *out,
 		int (*okfn)(struct sk_buff *))
 #endif
+
+#ifdef RHEL_RELEASE_CODE
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 0)
+		const struct net_device *in,	
+		const struct net_device *out,
+# endif
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 2)
+		const struct nf_hook_state *state)
+# else
+		int (*okfn)(struct sk_buff *))
+# endif
+#endif
 {
 	return core_4to6(skb, skb->dev);
 }
@@ -78,10 +98,22 @@
 static unsigned int hook_ipv6(HOOK_ARG_TYPE hook, struct sk_buff *skb,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
 		const struct nf_hook_state *state)
-#else
+#elif !defined(RHEL_RELEASE_CODE)
 		const struct net_device *in, const struct net_device *out,
 		int (*okfn)(struct sk_buff *))
 #endif
+
+#ifdef RHEL_RELEASE_CODE
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 0)
+		const struct net_device *in,	
+		const struct net_device *out,
+# endif
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 2)
+		const struct nf_hook_state *state)
+# else
+		int (*okfn)(struct sk_buff *))
+# endif
+#endif
 {
 	return core_6to4(skb, skb->dev);
 }
diff -Naur a/mod/stateless/nf_hook.c b/mod/stateless/nf_hook.c
--- a/mod/stateless/nf_hook.c	2015-11-20 15:26:28.000000000 +0000
+++ b/mod/stateless/nf_hook.c	2016-01-01 10:24:02.484000000 +0000
@@ -36,18 +36,38 @@
 
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
-#define HOOK_ARG_TYPE const struct nf_hook_ops *
+# define HOOK_ARG_TYPE const struct nf_hook_ops *
 #else
-#define HOOK_ARG_TYPE unsigned int
+# ifdef RHEL_RELEASE_CODE
+#  if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 0)
+#   define HOOK_ARG_TYPE const struct nf_hook_ops *
+#  endif
+# endif
+#endif
+
+#ifndef HOOK_ARG_TYPE
+# define HOOK_ARG_TYPE unsigned int
 #endif
 
 static unsigned int hook_ipv4(HOOK_ARG_TYPE hook, struct sk_buff *skb,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
 		const struct nf_hook_state *state)
-#else
+#elif !defined(RHEL_RELEASE_CODE)
 		const struct net_device *in, const struct net_device *out,
 		int (*okfn)(struct sk_buff *))
 #endif
+
+#ifdef RHEL_RELEASE_CODE
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 0)
+		const struct net_device *in,
+		const struct net_device *out,
+# endif
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 2)
+		const struct nf_hook_state *state)
+# else
+		int (*okfn)(struct sk_buff *))
+# endif
+#endif
 {
 	return core_4to6(skb, skb->dev);
 }
@@ -55,10 +75,22 @@
 static unsigned int hook_ipv6(HOOK_ARG_TYPE hook, struct sk_buff *skb,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
 		const struct nf_hook_state *state)
-#else
+#elif !defined(RHEL_RELEASE_CODE)
 		const struct net_device *in, const struct net_device *out,
 		int (*okfn)(struct sk_buff *))
 #endif
+
+#ifdef RHEL_RELEASE_CODE
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 0)
+		const struct net_device *in,
+		const struct net_device *out,
+# endif
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 2)
+		const struct nf_hook_state *state)
+# else
+		int (*okfn)(struct sk_buff *))
+# endif
+#endif
 {
 	return core_6to4(skb, skb->dev);
 }

Attachment: 20160101-jool-3.4.2-el7-build-fixes.patch.sig
Description: PGP signature

_______________________________________________
Jool-list mailing list
[email protected]
https://mail-lists.nic.mx/listas/listinfo/jool-list

Reply via email to