|
|
d956f8 |
commit 7cfb10eca050964b22bc8f25dd4682b409434078
|
|
|
d956f8 |
Author: Martin Cermak <mcermak@redhat.com>
|
|
|
d956f8 |
Date: Fri Jul 31 17:40:18 2015 +0200
|
|
|
d956f8 |
|
|
|
d956f8 |
Fix PR18711 by updating the netfilter code for new rhel-7.2 kernels.
|
|
|
d956f8 |
|
|
|
d956f8 |
* buildrun.cxx (compile_pass): Add new netfilter autoconf test.
|
|
|
d956f8 |
* runtime/linux/autoconf-netfilter-313b.c: New autoconf test.
|
|
|
d956f8 |
* tapset-netfilter.cxx: (emit_module_decls): Add support for new
|
|
|
d956f8 |
netfilter code backported to kernel-3.10.0-284.el7.
|
|
|
d956f8 |
|
|
|
d956f8 |
diff --git a/buildrun.cxx b/buildrun.cxx
|
|
|
d956f8 |
index e4b2697..d7a431d 100644
|
|
|
d956f8 |
--- a/buildrun.cxx
|
|
|
d956f8 |
+++ b/buildrun.cxx
|
|
|
d956f8 |
@@ -385,6 +385,7 @@ compile_pass (systemtap_session& s)
|
|
|
d956f8 |
output_autoconf(s, o, "autoconf-fs_supers-hlist.c", "STAPCONF_FS_SUPERS_HLIST", NULL);
|
|
|
d956f8 |
output_autoconf(s, o, "autoconf-compat_sigaction.c", "STAPCONF_COMPAT_SIGACTION", NULL);
|
|
|
d956f8 |
output_autoconf(s, o, "autoconf-netfilter.c", "STAPCONF_NETFILTER_V313", NULL);
|
|
|
d956f8 |
+ output_autoconf(s, o, "autoconf-netfilter-313b.c", "STAPCONF_NETFILTER_V313B", NULL);
|
|
|
d956f8 |
output_autoconf(s, o, "autoconf-netfilter-4_1.c", "STAPCONF_NETFILTER_V41", NULL);
|
|
|
d956f8 |
output_autoconf(s, o, "autoconf-smpcall-5args.c", "STAPCONF_SMPCALL_5ARGS", NULL);
|
|
|
d956f8 |
output_autoconf(s, o, "autoconf-smpcall-4args.c", "STAPCONF_SMPCALL_4ARGS", NULL);
|
|
|
d956f8 |
diff --git a/runtime/linux/autoconf-netfilter-313b.c b/runtime/linux/autoconf-netfilter-313b.c
|
|
|
d956f8 |
new file mode 100644
|
|
|
d956f8 |
index 0000000..3b18830
|
|
|
d956f8 |
--- /dev/null
|
|
|
d956f8 |
+++ b/runtime/linux/autoconf-netfilter-313b.c
|
|
|
d956f8 |
@@ -0,0 +1,22 @@
|
|
|
d956f8 |
+#include <linux/netfilter.h>
|
|
|
d956f8 |
+
|
|
|
d956f8 |
+// Similarly to autoconf-netfilter-4_1.c, this autoconf test covers
|
|
|
d956f8 |
+// backport of kernel patch 238e54c9cb9385a1ba99e92801f3615a2fb398b6
|
|
|
d956f8 |
+// to kernel-3.10.0-284.el7 per rhbz1230935#c4 as patch no 119478.
|
|
|
d956f8 |
+// This fixes PR18711.
|
|
|
d956f8 |
+
|
|
|
d956f8 |
+unsigned int
|
|
|
d956f8 |
+new_style_hook(const struct nf_hook_ops *ops,
|
|
|
d956f8 |
+ struct sk_buff *skb,
|
|
|
d956f8 |
+ const struct net_device *nf_in,
|
|
|
d956f8 |
+ const struct net_device *nf_out,
|
|
|
d956f8 |
+ const struct nf_hook_state *state)
|
|
|
d956f8 |
+{
|
|
|
d956f8 |
+ (void) ops; (void) skb; (void) nf_in; (void) nf_out; (void) state;
|
|
|
d956f8 |
+ return 0;
|
|
|
d956f8 |
+}
|
|
|
d956f8 |
+
|
|
|
d956f8 |
+struct nf_hook_ops netfilter_ops = {
|
|
|
d956f8 |
+ .hook = new_style_hook
|
|
|
d956f8 |
+};
|
|
|
d956f8 |
+
|
|
|
d956f8 |
diff --git a/tapset-netfilter.cxx b/tapset-netfilter.cxx
|
|
|
d956f8 |
index 12df8d7..a820b8d 100644
|
|
|
d956f8 |
--- a/tapset-netfilter.cxx
|
|
|
d956f8 |
+++ b/tapset-netfilter.cxx
|
|
|
d956f8 |
@@ -277,6 +277,11 @@ netfilter_derived_probe_group::emit_module_decls (systemtap_session& s)
|
|
|
d956f8 |
s.op->newline() << "(const struct nf_hook_ops *nf_ops, struct sk_buff *nf_skb, const struct net_device *nf_in, const struct net_device *nf_out, int (*nf_okfn)(struct sk_buff *))";
|
|
|
d956f8 |
s.op->newline() << "{";
|
|
|
d956f8 |
|
|
|
d956f8 |
+ s.op->newline() << "#elif defined(STAPCONF_NETFILTER_V313B)";
|
|
|
d956f8 |
+
|
|
|
d956f8 |
+ s.op->newline() << "(const struct nf_hook_ops *nf_ops, struct sk_buff *nf_skb, const struct net_device *nf_in, const struct net_device *nf_out, const struct nf_hook_state *nf_state)";
|
|
|
d956f8 |
+ s.op->newline() << "{";
|
|
|
d956f8 |
+
|
|
|
d956f8 |
s.op->newline() << "#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22)";
|
|
|
d956f8 |
|
|
|
d956f8 |
s.op->newline() << "(unsigned int nf_hooknum, struct sk_buff *nf_skb, const struct net_device *nf_in, const struct net_device *nf_out, int (*nf_okfn)(struct sk_buff *))";
|
|
|
d956f8 |
@@ -291,7 +296,7 @@ netfilter_derived_probe_group::emit_module_decls (systemtap_session& s)
|
|
|
d956f8 |
s.op->newline(-1) << "#endif";
|
|
|
d956f8 |
s.op->newline(1) << "const struct stap_probe * const stp = & stap_probes[" << np->session_index << "];";
|
|
|
d956f8 |
s.op->newline() << "int nf_verdict = NF_ACCEPT;"; // default NF_ACCEPT, to be used by $verdict context var
|
|
|
d956f8 |
- s.op->newline() << "#if defined(STAPCONF_NETFILTER_V313) || defined(STAPCONF_NETFILTER_V41)";
|
|
|
d956f8 |
+ s.op->newline() << "#if defined(STAPCONF_NETFILTER_V313) || defined(STAPCONF_NETFILTER_V313B) || defined(STAPCONF_NETFILTER_V41)";
|
|
|
d956f8 |
s.op->newline() << "unsigned int nf_hooknum = nf_ops->hooknum;";
|
|
|
d956f8 |
s.op->newline() << "#endif";
|
|
|
d956f8 |
s.op->newline() << "#ifdef STAPCONF_NETFILTER_V41";
|