summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tapset/inet_sock.stp8
-rw-r--r--tapset/ip.stp8
-rw-r--r--tapset/tcp.stp8
-rw-r--r--tapset/tcpmib.stp16
4 files changed, 40 insertions, 0 deletions
diff --git a/tapset/inet_sock.stp b/tapset/inet_sock.stp
index 33de9775..3962f5a1 100644
--- a/tapset/inet_sock.stp
+++ b/tapset/inet_sock.stp
@@ -16,7 +16,11 @@ function inet_get_local_port:long(sock:long)
%(kernel_v < "2.6.11" %?
port = @cast(sock, "inet_sock", "kernel")->inet->num;
%:
+%(kernel_v < "2.6.33" %?
port = @cast(sock, "inet_sock", "kernel")->num;
+%:
+ port = @cast(sock, "inet_sock", "kernel")->inet_num;
+%)
%)
return port;
}
@@ -27,7 +31,11 @@ function inet_get_ip_source:string(sock:long)
%(kernel_v < "2.6.11" %?
daddr = @cast(sock, "inet_sock", "kernel")->inet->daddr;
%:
+%(kernel_v < "2.6.33" %?
daddr = @cast(sock, "inet_sock", "kernel")->daddr;
+%:
+ daddr = @cast(sock, "inet_sock", "kernel")->inet_daddr;
+%)
%)
return daddr_to_string(daddr);
}
diff --git a/tapset/ip.stp b/tapset/ip.stp
index 299d88d2..ec17b7c0 100644
--- a/tapset/ip.stp
+++ b/tapset/ip.stp
@@ -26,13 +26,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 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
+%)
}
/* Get the IP header for recent (> 2.6.21) kernels */
diff --git a/tapset/tcp.stp b/tapset/tcp.stp
index 2c5dce7e..094161c9 100644
--- a/tapset/tcp.stp
+++ b/tapset/tcp.stp
@@ -76,7 +76,11 @@ function tcp_ts_get_info_state:long(sock:long)
/* return the TCP destination port for a given sock */
function __tcp_sock_dport:long (sock:long){
+%(kernel_v < "2.6.33" %?
return @cast(sock, "inet_sock")->dport
+%:
+ return @cast(sock, "inet_sock")->inet_dport
+%)
}
/* returns the TCP header for recent (<2.6.21) kernel */
@@ -145,7 +149,11 @@ function __tcp_skb_dport:long (tcphdr){
/* return the TCP source port for a given sock */
function __tcp_sock_sport:long (sock:long){
+%(kernel_v < "2.6.33" %?
return @cast(sock, "inet_sock")->sport
+%:
+ return @cast(sock, "inet_sock")->inet_sport
+%)
}
global sockstate[13], sockstate_init_p
diff --git a/tapset/tcpmib.stp b/tapset/tcpmib.stp
index aba7837b..cfaaf9c7 100644
--- a/tapset/tcpmib.stp
+++ b/tapset/tcpmib.stp
@@ -53,7 +53,11 @@ function tcpmib_get_state:long (sk:long)
function tcpmib_local_addr:long(sk:long)
%{ /* pure */
struct inet_sock *inet = (struct inet_sock *) (long) THIS->sk;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ THIS->__retvalue = ntohl(kread(&(inet->inet_saddr)));
+#else
THIS->__retvalue = ntohl(kread(&(inet->saddr)));
+#endif
CATCH_DEREF_FAULT();
%}
@@ -67,7 +71,11 @@ function tcpmib_local_addr:long(sk:long)
function tcpmib_remote_addr:long(sk:long)
%{ /* pure */
struct inet_sock *inet = (struct inet_sock *) (long) THIS->sk;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ THIS->__retvalue = ntohl(kread(&(inet->inet_daddr)));
+#else
THIS->__retvalue = ntohl(kread(&(inet->daddr)));
+#endif
CATCH_DEREF_FAULT();
%}
@@ -81,7 +89,11 @@ function tcpmib_remote_addr:long(sk:long)
function tcpmib_local_port:long(sk:long)
%{ /* pure */
struct inet_sock *inet = (struct inet_sock *) (long) THIS->sk;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ THIS->__retvalue = ntohs(kread(&(inet->inet_sport)));
+#else
THIS->__retvalue = ntohs(kread(&(inet->sport)));
+#endif
CATCH_DEREF_FAULT();
%}
@@ -95,7 +107,11 @@ function tcpmib_local_port:long(sk:long)
function tcpmib_remote_port:long(sk:long)
%{ /* pure */
struct inet_sock *inet = (struct inet_sock *) (long) THIS->sk;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ THIS->__retvalue = ntohs(kread(&(inet->inet_dport)));
+#else
THIS->__retvalue = ntohs(kread(&(inet->dport)));
+#endif
CATCH_DEREF_FAULT();
%}