imq / linuximq

Pseudo-driver for the intermediate queue device.

Home Page:https://imq.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail to patch 4.4.162 with linux-4.4.32-imq.diff

wirelessmundi opened this issue · comments

Hi,
When patching the current linux kernel 4.4.162 it fails to patch, should we use patch 4.4-imq.diff?

Thanks,

Output:
linux-4.4.162]# patch -p1 < ../patches/linux-4.4.32-imq.diff
patching file drivers/net/imq.c
patching file drivers/net/Kconfig
patching file drivers/net/Makefile
patching file include/linux/imq.h
patching file include/linux/netdevice.h
Hunk #1 succeeded at 3413 (offset 16 lines).
patching file include/linux/netfilter/xt_IMQ.h
patching file include/linux/netfilter_ipv4/ipt_IMQ.h
patching file include/linux/netfilter_ipv6/ip6t_IMQ.h
patching file include/linux/skbuff.h
Hunk #2 succeeded at 572 (offset 1 line).
Hunk #3 succeeded at 584 (offset 1 line).
Hunk #6 succeeded at 3444 (offset 12 lines).
patching file include/net/netfilter/nf_queue.h
Hunk #1 succeeded at 31 with fuzz 2.
patching file include/net/pkt_sched.h
patching file include/net/sch_generic.h
patching file include/uapi/linux/netfilter.h
patching file net/core/dev.c
Hunk #2 succeeded at 2776 (offset 63 lines).
Hunk #3 succeeded at 2819 (offset 63 lines).
patching file net/core/skbuff.c
Hunk #4 succeeded at 3456 with fuzz 1 (offset 22 lines).
patching file net/ipv6/ip6_output.c
patching file net/netfilter/core.c
patching file net/netfilter/Kconfig
patching file net/netfilter/Makefile
patching file net/netfilter/nf_internals.h
patching file net/netfilter/nf_queue.c
Hunk #1 succeeded at 27 with fuzz 2 (offset -1 lines).
Hunk #2 succeeded at 131 (offset -2 lines).
Hunk #3 FAILED at 142.
Hunk #4 succeeded at 216 (offset -1 lines).
1 out of 4 hunks FAILED -- saving rejects to file net/netfilter/nf_queue.c.rej
patching file net/netfilter/xt_IMQ.c
patching file net/sched/sch_generic.c

linux-4.4.162]# cat net/netfilter/nf_queue.c.rej
--- net/netfilter/nf_queue.c 2016-01-11 05:01:32.000000000 +0600
+++ net/netfilter/nf_queue.c 2016-12-03 20:11:46.566088622 +0700
@@ -142,7 +160,17 @@ int nf_queue(struct sk_buff *skb,
const struct nf_queue_handler *qh;

/* QUEUE == DROP if no one is waiting, to be safe. */
- qh = rcu_dereference(queue_handler);
+ if (queuetype == NF_IMQ_QUEUE) {
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ qh = rcu_dereference(queue_imq_handler);
+#else
+ BUG();
+ goto err_unlock;
+#endif
+ } else {
+ qh = rcu_dereference(queue_handler);
+ }
+
if (!qh) {
status = -ESRCH;
goto err;

I think is the same issue as in #70
I apply the following changes:
--- linux-4.4.32-imq.orig.diff 2018-10-22 19:21:29.000000000 +0200
+++ linux-4.4.32-imq.diff 2018-10-22 19:09:42.000000000 +0200
@@ -1560,7 +1560,7 @@
const struct nf_queue_handler *qh;

linux-4.4.162-imq.diff.txt
/* QUEUE == DROP if no one is waiting, to be safe. */
-- qh = rcu_dereference(queue_handler);
+- qh = rcu_dereference(net->nf.queue_handler);
+ if (queuetype == NF_IMQ_QUEUE) {
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
+ qh = rcu_dereference(queue_imq_handler);
@@ -1569,7 +1569,7 @@
+ goto err_unlock;
+#endif
+ } else {
-+ qh = rcu_dereference(queue_handler);
++ qh = rcu_dereference(net->nf.queue_handler);
+ }
+
if (!qh) {

Attach the modified patch for others.

The patch modified by @wirelessmundi worked for the elrepo kernel-lt-4.4.238-1.el7. Thanks for sharing!