diff options
author | Steve Dickson <steved@redhat.com> | 2010-02-23 11:58:16 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-03-16 11:11:22 -0400 |
commit | 31e1d6706cf0c575f9709938c5b388656fd6302d (patch) | |
tree | 62cfce50981d8deb62ba7fa029c712ea44cbedab /tapset/rpc.stp | |
parent | fb36412650985d057243291e5aec9a4cc4032e8d (diff) | |
download | systemtap-steved-31e1d6706cf0c575f9709938c5b388656fd6302d.tar.gz systemtap-steved-31e1d6706cf0c575f9709938c5b388656fd6302d.tar.xz systemtap-steved-31e1d6706cf0c575f9709938c5b388656fd6302d.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.stp | 24 |
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(); +%} + |