diff options
author | Breno Leitao <leitao@linux.vnet.ibm.com> | 2009-03-20 11:40:04 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2009-03-20 12:00:22 -0400 |
commit | 52064a4bd37f8d81e1f488fe9d32fe6ccee63bd7 (patch) | |
tree | b667f621fad0b4049d735202e1256717ad843f4f /tapset/ip.stp | |
parent | 0cf9ea606eb7677a1241595f7568dd4a6c243ef2 (diff) | |
download | systemtap-steved-52064a4bd37f8d81e1f488fe9d32fe6ccee63bd7.tar.gz systemtap-steved-52064a4bd37f8d81e1f488fe9d32fe6ccee63bd7.tar.xz systemtap-steved-52064a4bd37f8d81e1f488fe9d32fe6ccee63bd7.zip |
Added functions to grab IP source and destination from a socket, and
functions to grab TCP source and destination port from a socket.
Also, used this function inside some TCP probe functions, as recvmsg,
to provide a richer set of fields.
Diffstat (limited to 'tapset/ip.stp')
-rw-r--r-- | tapset/ip.stp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tapset/ip.stp b/tapset/ip.stp new file mode 100644 index 00000000..1e2e263c --- /dev/null +++ b/tapset/ip.stp @@ -0,0 +1,32 @@ +// 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> + +/** + * 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 +} |