|
|
f43afa |
diff --git a/buildrun.cxx b/buildrun.cxx
|
|
|
f43afa |
index 3c26d50..cfb3ae0 100644
|
|
|
f43afa |
--- a/buildrun.cxx
|
|
|
f43afa |
+++ b/buildrun.cxx
|
|
|
f43afa |
@@ -1,5 +1,5 @@
|
|
|
f43afa |
// build/run probes
|
|
|
f43afa |
-// Copyright (C) 2005-2013 Red Hat Inc.
|
|
|
f43afa |
+// Copyright (C) 2005-2014 Red Hat Inc.
|
|
|
f43afa |
//
|
|
|
f43afa |
// This file is part of systemtap, and is free software. You can
|
|
|
f43afa |
// redistribute it and/or modify it under the terms of the GNU General
|
|
|
f43afa |
@@ -378,6 +378,7 @@ compile_pass (systemtap_session& s)
|
|
|
f43afa |
output_autoconf(s, o, "autoconf-relay-umode_t.c", "STAPCONF_RELAY_UMODE_T", NULL);
|
|
|
f43afa |
output_autoconf(s, o, "autoconf-fs_supers-hlist.c", "STAPCONF_FS_SUPERS_HLIST", NULL);
|
|
|
f43afa |
output_autoconf(s, o, "autoconf-compat_sigaction.c", "STAPCONF_COMPAT_SIGACTION", NULL);
|
|
|
f43afa |
+ output_autoconf(s, o, "autoconf-netfilter.c", "STAPCONF_NETFILTER_V313", NULL);
|
|
|
f43afa |
|
|
|
f43afa |
// used by tapset/timestamp_monotonic.stp
|
|
|
f43afa |
output_exportconf(s, o, "cpu_clock", "STAPCONF_CPU_CLOCK");
|
|
|
f43afa |
diff --git a/man/stapprobes.3stap b/man/stapprobes.3stap
|
|
|
f43afa |
index 4bc99fc..2229c9c 100644
|
|
|
f43afa |
--- a/man/stapprobes.3stap
|
|
|
f43afa |
+++ b/man/stapprobes.3stap
|
|
|
f43afa |
@@ -1043,6 +1043,9 @@ the C code generated by systemtap.
|
|
|
f43afa |
|
|
|
f43afa |
The netfilter probe points define the following context variables:
|
|
|
f43afa |
.TP
|
|
|
f43afa |
+.IR $hooknum
|
|
|
f43afa |
+The hook number.
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
.IR $skb
|
|
|
f43afa |
The address of the sk_buff struct representing the packet. See
|
|
|
f43afa |
<linux/skbuff.h> for details on how to use this struct, or
|
|
|
f43afa |
diff --git a/runtime/linux/autoconf-netfilter.c b/runtime/linux/autoconf-netfilter.c
|
|
|
f43afa |
new file mode 100644
|
|
|
f43afa |
index 0000000..f122664
|
|
|
f43afa |
--- /dev/null
|
|
|
f43afa |
+++ b/runtime/linux/autoconf-netfilter.c
|
|
|
f43afa |
@@ -0,0 +1,16 @@
|
|
|
f43afa |
+#include <linux/netfilter.h>
|
|
|
f43afa |
+
|
|
|
f43afa |
+unsigned int
|
|
|
f43afa |
+new_style_hook(const struct nf_hook_ops *ops, /* not: unsigned int hook; */
|
|
|
f43afa |
+ struct sk_buff *skb,
|
|
|
f43afa |
+ const struct net_device *in, const struct net_device *out,
|
|
|
f43afa |
+ int (*okfn)(struct sk_buff *))
|
|
|
f43afa |
+{
|
|
|
f43afa |
+ (void) ops; (void) skb; (void) in; (void) out; (void) okfn;
|
|
|
f43afa |
+ return 0;
|
|
|
f43afa |
+}
|
|
|
f43afa |
+
|
|
|
f43afa |
+struct nf_hook_ops netfilter_ops = {
|
|
|
f43afa |
+ .hook = new_style_hook
|
|
|
f43afa |
+};
|
|
|
f43afa |
+
|
|
|
f43afa |
diff --git a/tapset-netfilter.cxx b/tapset-netfilter.cxx
|
|
|
f43afa |
index f20b569..eec7e31 100644
|
|
|
f43afa |
--- a/tapset-netfilter.cxx
|
|
|
f43afa |
+++ b/tapset-netfilter.cxx
|
|
|
f43afa |
@@ -1,5 +1,5 @@
|
|
|
f43afa |
// tapset for netfilter hooks
|
|
|
f43afa |
-// Copyright (C) 2012 Red Hat Inc.
|
|
|
f43afa |
+// Copyright (C) 2012-2014 Red Hat Inc.
|
|
|
f43afa |
//
|
|
|
f43afa |
// This file is part of systemtap, and is free software. You can
|
|
|
f43afa |
// redistribute it and/or modify it under the terms of the GNU General
|
|
|
f43afa |
@@ -267,7 +267,13 @@ netfilter_derived_probe_group::emit_module_decls (systemtap_session& s)
|
|
|
f43afa |
// Previous to kernel 2.6.22, the hookfunction definition takes a struct sk_buff **skb,
|
|
|
f43afa |
// whereas currently it uses a *skb. We need emit the right version so this will
|
|
|
f43afa |
// compile on RHEL5, for example.
|
|
|
f43afa |
- s.op->newline() << "#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22)";
|
|
|
f43afa |
+ s.op->newline() << "#ifdef STAPCONF_NETFILTER_V313";
|
|
|
f43afa |
+
|
|
|
f43afa |
+ 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 *))";
|
|
|
f43afa |
+ s.op->newline() << "{";
|
|
|
f43afa |
+
|
|
|
f43afa |
+ s.op->newline() << "#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22)";
|
|
|
f43afa |
+
|
|
|
f43afa |
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 *))";
|
|
|
f43afa |
s.op->newline() << "{";
|
|
|
f43afa |
|
|
|
f43afa |
@@ -280,6 +286,9 @@ netfilter_derived_probe_group::emit_module_decls (systemtap_session& s)
|
|
|
f43afa |
s.op->newline(-1) << "#endif";
|
|
|
f43afa |
s.op->newline(1) << "const struct stap_probe * const stp = & stap_probes[" << np->session_index << "];";
|
|
|
f43afa |
s.op->newline() << "int nf_verdict = NF_ACCEPT;"; // default NF_ACCEPT, to be used by $verdict context var
|
|
|
f43afa |
+ s.op->newline() << "#ifdef STAPCONF_NETFILTER_V313";
|
|
|
f43afa |
+ s.op->newline() << "unsigned int nf_hooknum = nf_ops->hooknum;";
|
|
|
f43afa |
+ s.op->newline() << "#endif";
|
|
|
f43afa |
common_probe_entryfn_prologue (s, "STAP_SESSION_RUNNING", "stp",
|
|
|
f43afa |
"stp_probe_type_netfilter",
|
|
|
f43afa |
false);
|