diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-07-11 11:58:52 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-07-11 11:58:52 +0200 |
commit | b2b61f91a752d8221addcbabb3c630766af081e4 (patch) | |
tree | a15ece60777da9a1e4b305692089884297e3aec7 /tapset/aux_syscalls.stp | |
parent | a704a23b6653df973d919516d4ebf4886a84824f (diff) | |
download | systemtap-steved-b2b61f91a752d8221addcbabb3c630766af081e4.tar.gz systemtap-steved-b2b61f91a752d8221addcbabb3c630766af081e4.tar.xz systemtap-steved-b2b61f91a752d8221addcbabb3c630766af081e4.zip |
Don't accidentially use user space ntohs function.
The definition of ntohs comes from user space include headers
netinet/in.h which could define it as function instead of macro.
So use builtin kernel be16_to_cpu instead.
* tapset/aux_syscalls.stp (_struct_sockaddr_u): Define and use _stp_ntohs
as be16_to_cpu.
Diffstat (limited to 'tapset/aux_syscalls.stp')
-rw-r--r-- | tapset/aux_syscalls.stp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index 9cb7a3df..9347e46f 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -292,6 +292,9 @@ function _struct_sockaddr_u:string(uaddr:long, len:long) #define DADDR (&inet->daddr) #endif +// Use kernel builtin instead of picking up user space ntohs (function). +#define _stp_ntohs be16_to_cpu + //FIXME. Not done yet. char *str = THIS->__retvalue; const int strlen = MAXSTRINGLEN; @@ -301,7 +304,7 @@ function _struct_sockaddr_u:string(uaddr:long, len:long) struct sockaddr_in *sin = (struct sockaddr_in *)buf; const unsigned char *addr = (unsigned char *)&sin->sin_addr; snprintf(str, strlen, "{AF_INET, %d.%d.%d.%d, %d}", - addr[0], addr[1], addr[2], addr[3], ntohs(sin->sin_port)); + addr[0], addr[1], addr[2], addr[3], _stp_ntohs(sin->sin_port)); } else if ((sa->sa_family == AF_UNIX)&&(len == sizeof(struct sockaddr_un))) { @@ -318,7 +321,7 @@ function _struct_sockaddr_u:string(uaddr:long, len:long) // FIXME. Address is probably not correctly displayed struct sockaddr_in6 *sin = (struct sockaddr_in6 *)buf; snprintf(str, strlen, "{AF_INET6, %016llx, %d}", - *(long long *)&sin->sin6_addr, ntohs(sin->sin6_port)); + *(long long *)&sin->sin6_addr, _stp_ntohs(sin->sin6_port)); } else if ((sa->sa_family == AF_PACKET)&&(len == sizeof(struct sockaddr_ll))) { |