diff options
author | David Smith <dsmith@redhat.com> | 2010-03-26 13:24:38 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2010-03-26 13:24:38 -0500 |
commit | 961479c253ded0d1a7331e8d064ffbc0ca3358d7 (patch) | |
tree | 21b11aca671c8d74c5584fec7dbd4b255b81b832 /tapset/ip.stp | |
parent | fc80eab8cc1cbebad78df914a885cb74cbd91f22 (diff) | |
download | systemtap-steved-961479c253ded0d1a7331e8d064ffbc0ca3358d7.tar.gz systemtap-steved-961479c253ded0d1a7331e8d064ffbc0ca3358d7.tar.xz systemtap-steved-961479c253ded0d1a7331e8d064ffbc0ca3358d7.zip |
PR 9871/11338 fix in tcpmib.stp by removing embedded-C and using @defined.
* tapset/tcpmib.stp (tcpmib_get_state): Changed from embedded-C to script
code.
(tcpmib_local_addr): Instead of an embedded-C function, now calls
function from ip.stp/tcp.stp.
(tcpmib_remote_addr): Ditto.
(tcpmib_local_port): Ditto.
(tcpmib_remote_port): Ditto.
(tcpmib.OutRsts.A): Used '@defined' instead of a kernel version check.
* tapset/ip.stp (__ip_sock_saddr): Used '@defined' instead of a kernel
version check. Added RHEL4 support.
(__ip_sock_daddr): Ditto.
* tapset/tcp.stp (__tcp_sock_dport): Ditto.
(__tcp_sock_sport): Ditto.
Diffstat (limited to 'tapset/ip.stp')
-rw-r--r-- | tapset/ip.stp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tapset/ip.stp b/tapset/ip.stp index ec17b7c0..123a2728 100644 --- a/tapset/ip.stp +++ b/tapset/ip.stp @@ -1,5 +1,8 @@ // IP tapset +// // Copyright (C) 2009, IBM Inc. +// Copyright (C) 2010, Red Hat Inc. +// // Author : Breno Leitao <leitao@linux.vnet.ibm.com> // // This file is free software. You can redistribute it and/or modify it under @@ -26,21 +29,21 @@ function ip_ntop:string (addr:long) /* return the source IP address for a given sock */ function __ip_sock_saddr:long (sock:long) { -%(kernel_v < "2.6.33" %? - return @cast(sock, "inet_sock")->saddr -%: - return @cast(sock, "inet_sock")->inet_saddr -%) + return (@defined(@cast(sock, "inet_sock")->inet_saddr) + ? @cast(sock, "inet_sock")->inet_saddr # kernel >= 2.6.33 + : (@defined(@cast(sock, "inet_sock")->saddr) + ? @cast(sock, "inet_sock", "kernel")->saddr # kernel >= 2.6.11 + : @cast(sock, "inet_sock", "kernel<net/ip.h>")->inet->saddr)) } /* return the destination IP address for a given sock */ function __ip_sock_daddr:long (sock:long) { -%(kernel_v < "2.6.33" %? - return @cast(sock, "inet_sock")->daddr -%: - return @cast(sock, "inet_sock")->inet_daddr -%) + return (@defined(@cast(sock, "inet_sock")->inet_daddr) + ? @cast(sock, "inet_sock")->inet_daddr # kernel >= 2.6.33 + : (@defined(@cast(sock, "inet_sock")->daddr) + ? @cast(sock, "inet_sock", "kernel")->daddr # kernel >= 2.6.11 + : @cast(sock, "inet_sock", "kernel<net/ip.h>")->inet->daddr)) } /* Get the IP header for recent (> 2.6.21) kernels */ |