Skip to content

Instantly share code, notes, and snippets.

@pandax381
Last active November 13, 2015 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandax381/04a718b9ccc0e0a94d7f to your computer and use it in GitHub Desktop.
Save pandax381/04a718b9ccc0e0a94d7f to your computer and use it in GitHub Desktop.
Unofficial patch for Jool-3.4.0 for kernel 4.1 or later.
diff -ur Jool-3.4.0.orig/mod/common/core.c Jool-3.4.0/mod/common/core.c
--- Jool-3.4.0.orig/mod/common/core.c 2015-11-05 07:35:11.000000000 +0900
+++ Jool-3.4.0/mod/common/core.c 2015-11-11 17:54:38.888931547 +0900
@@ -67,7 +67,7 @@
static bool check_namespace(const struct net_device *dev)
{
#ifdef CONFIG_NET_NS
- if (dev && dev->nd_net != joolns_get())
+ if (dev && dev->nd_net.net != joolns_get())
return false;
#endif
return true;
diff -ur Jool-3.4.0.orig/mod/common/namespace.c Jool-3.4.0/mod/common/namespace.c
--- Jool-3.4.0.orig/mod/common/namespace.c 2015-11-05 07:35:11.000000000 +0900
+++ Jool-3.4.0/mod/common/namespace.c 2015-11-11 18:32:47.037949121 +0900
@@ -1,5 +1,6 @@
#include "nat64/mod/common/namespace.h"
#include <linux/sched.h>
+#include <linux/err.h>
#include "nat64/mod/common/types.h"
struct net *jool_net;
@@ -7,9 +8,9 @@
int joolns_init(void)
{
jool_net = get_net_ns_by_pid(task_pid_nr(current));
- if (!jool_net) {
+ if (IS_ERR(jool_net)) {
log_err("Could not retrieve the current namespace.");
- return -ESRCH;
+ return PTR_ERR(jool_net);
}
return 0;
diff -ur Jool-3.4.0.orig/mod/stateful/nf_hook.c Jool-3.4.0/mod/stateful/nf_hook.c
--- Jool-3.4.0.orig/mod/stateful/nf_hook.c 2015-11-05 07:35:11.000000000 +0900
+++ Jool-3.4.0/mod/stateful/nf_hook.c 2015-11-11 19:11:15.624646038 +0900
@@ -64,17 +64,15 @@
#endif
static unsigned int hook_ipv4(HOOK_ARG_TYPE hook, struct sk_buff *skb,
- const struct net_device *in, const struct net_device *out,
- int (*okfn)(struct sk_buff *))
+ const struct nf_hook_state *state)
{
- return core_4to6(skb, in);
+ return core_4to6(skb, skb->dev);
}
static unsigned int hook_ipv6(HOOK_ARG_TYPE hook, struct sk_buff *skb,
- const struct net_device *in, const struct net_device *out,
- int (*okfn)(struct sk_buff *))
+ const struct nf_hook_state *state)
{
- return core_6to4(skb, in);
+ return core_6to4(skb, skb->dev);
}
static struct nf_hook_ops nfho[] = {
diff -ur Jool-3.4.0.orig/mod/stateless/nf_hook.c Jool-3.4.0/mod/stateless/nf_hook.c
--- Jool-3.4.0.orig/mod/stateless/nf_hook.c 2015-11-05 07:35:11.000000000 +0900
+++ Jool-3.4.0/mod/stateless/nf_hook.c 2015-11-11 19:11:43.524365030 +0900
@@ -41,17 +41,15 @@
#endif
static unsigned int hook_ipv4(HOOK_ARG_TYPE hook, struct sk_buff *skb,
- const struct net_device *in, const struct net_device *out,
- int (*okfn)(struct sk_buff *))
+ const struct nf_hook_state *state)
{
- return core_4to6(skb, in);
+ return core_4to6(skb, skb->dev);
}
static unsigned int hook_ipv6(HOOK_ARG_TYPE hook, struct sk_buff *skb,
- const struct net_device *in, const struct net_device *out,
- int (*okfn)(struct sk_buff *))
+ const struct nf_hook_state *state)
{
- return core_6to4(skb, in);
+ return core_6to4(skb, skb->dev);
}
static struct nf_hook_ops nfho[] = {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment