This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Tapset for TCP
Arnaldo,
Arnaldo Carvalho de Melo wrote:
> Fell thru the cracks, at some point I discussed it with several
> systemtap guys, Will Cohen provided valuable review, etc.
Please, consider this patch to fix these tapset to run against the
last SystemTap source and kernel 2.6.29-rc7. So that we can send
these files upstream.
Thanks
--
Fixed the code to run upstream:
- removed the already upstream skb_network_header(), ip_hdr() and
tcp_hdr()
- Include ip.h that define these functions
- fix ntop. On 64 bits arch, NIPQUAD() considers the most significant
bytes on a long field, instead of a __be32.
Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
---
tapset/inet_sock.stp | 5 ++++-
tapset/iphdr.stp | 10 ----------
tapset/tcphdr.stp | 11 +----------
3 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/tapset/inet_sock.stp b/tapset/inet_sock.stp
index de40b91..e12d5f4 100644
--- a/tapset/inet_sock.stp
+++ b/tapset/inet_sock.stp
@@ -12,7 +12,10 @@
function inet_sk_ntop:string (addr:long)
%{
- snprintf(THIS->__retvalue, MAXSTRINGLEN, NIPQUAD_FMT, NIPQUAD(THIS->addr));
+ __be32 ip;
+
+ ip = THIS->addr;
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, NIPQUAD_FMT, NIPQUAD(ip));
%}
function inet_sk_saddr:long (sk:long)
diff --git a/tapset/iphdr.stp b/tapset/iphdr.stp
index ad9995c..fffdc77 100644
--- a/tapset/iphdr.stp
+++ b/tapset/iphdr.stp
@@ -14,16 +14,6 @@ static inline struct iphdr *ip_hdr(struct sk_buff *skb)
{
return (struct iphdr *)skb->nh.raw;
}
-#else
-static inline unsigned char *skb_network_header(const struct sk_buff *skb)
-{
- return skb->head + skb->network_header;
-}
-
-static inline struct iphdr *ip_hdr(struct sk_buff *skb)
-{
- return (struct iphdr *)skb_network_header(skb);
-}
#endif
%}
diff --git a/tapset/tcphdr.stp b/tapset/tcphdr.stp
index 694b8b4..7be56e4 100644
--- a/tapset/tcphdr.stp
+++ b/tapset/tcphdr.stp
@@ -8,6 +8,7 @@
%{
#include <linux/in.h>
#include <linux/tcp.h>
+#include <linux/ip.h>
#include <linux/skbuff.h>
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21)
@@ -15,16 +16,6 @@ static inline struct tcphdr *tcp_hdr(struct sk_buff *skb)
{
return (struct tcphdr *)skb->h.raw;
}
-#else
-static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
-{
- return skb->head + skb->transport_header;
-}
-
-static inline struct tcphdr *tcp_hdr(struct sk_buff *skb)
-{
- return (struct tcphdr *)skb_transport_header(skb);
-}
#endif
%}
--
1.6.0.2