summaryrefslogtreecommitdiffstats
path: root/tapset/rpc.stp
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2010-02-23 11:58:16 -0500
committerSteve Dickson <steved@redhat.com>2010-02-23 11:58:16 -0500
commit6be80943cc84cdb08c51f528aec5b59a9fdb3d30 (patch)
tree6c2144fb15c7567dec48e012b0f28c3da7a4064d /tapset/rpc.stp
parent0c5c7a83eb9bb1fbb994970d5da7d1e638a90f67 (diff)
downloadsystemtap-steved-6be80943cc84cdb08c51f528aec5b59a9fdb3d30.tar.gz
systemtap-steved-6be80943cc84cdb08c51f528aec5b59a9fdb3d30.tar.xz
systemtap-steved-6be80943cc84cdb08c51f528aec5b59a9fdb3d30.zip
Allow better filtering with IP address and File handle
To allow filtering by the client's IP address, the addr_from_rqst_str() function was added which extracts the IP address from incoming procedures and converts them into a character string. Calls to addr_from_rqst_str() were added to the top of each probe so callers of the probes can use the IP addresses as a filter. Calls to __svc_fh() were also sprinkled were needed so callers can also filter on file handles Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'tapset/rpc.stp')
-rw-r--r--tapset/rpc.stp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tapset/rpc.stp b/tapset/rpc.stp
index 1d47daed..3e65d0ea 100644
--- a/tapset/rpc.stp
+++ b/tapset/rpc.stp
@@ -988,3 +988,27 @@ function addr_from_rqst:long(rqstp:long)
CATCH_DEREF_FAULT();
%}
+function addr_from_rqst_str:string(_rqstp:long)
+%{ /* pure */
+ struct svc_rqst *rqstp =
+ (struct svc_rqst *)(long) kread(&(THIS->_rqstp));
+ struct sockaddr_in *addr;
+ unsigned char *bytes;
+
+ if (rqstp) {
+ if (rqstp->rq_addr.ss_family == AF_INET) {
+ addr = (struct sockaddr_in *) &rqstp->rq_addr;
+ bytes = (unsigned char *)&addr->sin_addr.s_addr;
+
+ snprintf(THIS->__retvalue, MAXSTRINGLEN,
+ "%d.%d.%d.%d:%d", bytes[0], bytes[1], bytes[2], bytes[3],
+ addr->sin_port);
+ } else
+ snprintf(THIS->__retvalue, MAXSTRINGLEN,
+ "Unsupported Address Family");
+ } else
+ snprintf(THIS->__retvalue, MAXSTRINGLEN, "Null");
+
+ CATCH_DEREF_FAULT();
+%}
+