| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/systemtap/tapset/ |
Upload File : |
// IP tapset
// Copyright (C) 2009, IBM Inc.
// Author : Breno Leitao <leitao@linux.vnet.ibm.com>
//
// This file is free software. You can redistribute it and/or modify it under
// the terms of the GNU General Public License (GPL), version 2.
//
// Based on previous work done by Arnaldo Carvalho de Melo <acme@redhat.com>
%{
#include <linux/skbuff.h>
%}
/**
* sfunction ip_ntop - returns a string representation from an integer IP number
* @addr: the ip represented as an integer
*/
function ip_ntop:string (addr:long)
%{
__be32 ip;
ip = THIS->addr;
snprintf(THIS->__retvalue, MAXSTRINGLEN, NIPQUAD_FMT, NIPQUAD(ip));
%}
/* return the source IP address for a given sock */
function __ip_sock_saddr:long (sock:long)
{
return @cast(sock, "inet_sock")->saddr
}
/* return the destination IP address for a given sock */
function __ip_sock_daddr:long (sock:long)
{
return @cast(sock, "inet_sock")->daddr
}
/* Get the IP header for recent (> 2.6.21) kernels */
function __get_skb_iphdr_new:long(skb:long)
%{ /* pure */
struct sk_buff *skb;
skb = (struct sk_buff *)(long)THIS->skb;
/* as done by skb_network_header() */
#ifdef NET_SKBUFF_DATA_USES_OFFSET
THIS->__retvalue = (long)(kread(&(skb->head)) + kread(&(skb->network_header)));
#else
THIS->__retvalue = (long)kread(&(skb->network_header));
#endif
CATCH_DEREF_FAULT();
%}
/* Get the IP header from a sk_buff struct */
function __get_skb_iphdr:long(skb:long){
%( kernel_v < "2.6.21" %?
iphdr = @cast(skb, "sk_buff")->nh->raw
return iphdr
%:
return __get_skb_iphdr_new(skb)
%)
}
/* return the source next layer protocol for a given sk_buff structure */
function __ip_skb_proto:long (iphdr)
{
return @cast(iphdr, "iphdr")->protocol
}
/* return the source IP address for a given sk_buff structure */
function __ip_skb_saddr:long (iphdr)
{
return @cast(iphdr, "iphdr")->saddr
}
/* return the destination IP address for a given skb */
function __ip_skb_daddr:long (iphdr)
{
return @cast(iphdr, "iphdr")->daddr
}