Commit Graph

154 Commits

Author SHA1 Message Date
Mike Frysinger
54646b8e05 decode extend getsockopt/setsockopt options
Currently the code assumes the set of valid options between getsockopt
and setsockopt are exactly the same and thus maintains one list.  The
kernel unfortunately does not do this -- it allows for different opts
between the get and set functions.  See the {g,s}et_opt{min,max} fields
in the various netfilter subcores.

To support this, extend the printxval function to take multiple sets of
xlats as varargs.  Then we add the new get/set lists, and pass them down
in the net code when decoding things.

A simple example is iptables; before:
	getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
	getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
after:
	getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
	getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0

If these were setsockopt calls, then 0x40 & 0x41 would be
IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.

* configure.ac: Check for netfilter headers.
* defs.h (printxvals): New prototype.
(printxval): Change to a define.
* net.c: Include netfilter headers and new sockopts headers.
(print_sockopt_fd_level_name): Add a is_getsockopt argument.  Change SOL_IP
and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
xlats down.
(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
* util.c (printxval): Rename to ...
(printxvals): ... this.  Rewrite to be varargs based.
* xlat/getsockipoptions.in: New xlat list.
* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
xlat/setsockipv6options.in: Likewise.
2015-08-26 12:09:25 +00:00
2a4f0521fc pipe, pipe2, socketpair: print returned descriptors using printfd
* net.c (printpair_fd, decode_pair_fd): New functions.
(do_pipe, sys_socketpair): Use them.
2015-08-03 09:09:26 +00:00
3d463be47e socket: mark return code with RVAL_FD flag
* net.c (sys_socket): Set RVAL_FD flag in the return code.
* tests/net-yy-accept.awk: Update socket and bind regexps.
* tests/unix-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Update socket and connect regexps.
* tests/unix-yy-connect.awk: Likewise.
2015-08-03 09:09:26 +00:00
52dc1506ab net.c: use printaddr
* net.c (printsock, sys_recvfrom): Use printaddr.
2015-07-30 13:53:42 +00:00
Denys Vlasenko
383386de73 net.c: recvfrom fixes
This change fixes these three problems (before/after is shown):

On interrupted syscall, flags are not decoded:

    -recvfrom(3, 0x7fff0a41e306, 10, 2, 0, 0) = ? ERESTARTSYS
    +recvfrom(3, 0x7fff0a41e306, 10, MSG_PEEK, 0, 0) = ? ERESTARTSYS

If peer address is unavalable (example: anon sockets from socketpair()),
kernel returns socklen of 0, but we ignore that and show bogus sockaddr data:

    -recvfrom(3, "123456789\0", 10, MSG_PEEK, {sa_family=0x7777 /* AF_??? */, sa_data="wwwwwwwwwwwwww"}, [0]) = 10
    +recvfrom(3, "123456789\0", 10, MSG_PEEK, 0x7ffde6edf760, [0]) = 10

SYS_FUNC(recvfrom) passes address of fromlen, not fromlen, to printsock():

    -               printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]);
    +               printsock(tcp, tcp->u_arg[4], fromlen);

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-07-30 13:38:32 +02:00
771c2a4651 Alias sys_connect to sys_bind
* linux/dummy.h (sys_connect): Alias to sys_bind.
* net.c (sys_connect): Remove.
2015-07-20 01:42:00 +00:00
219b3a79b4 net.c: make use of RVAL_DECODED
* net.c (sys_socket, sys_bind, sys_listen, sys_send, sys_sendto,
sys_sendmsg, sys_shutdown, sys_setsockopt): Update for RVAL_DECODED.
2015-07-20 01:42:00 +00:00
6c277da205 net.c: use printaddr and umove_or_printaddr
* net.c (printsock): Use printaddr and umove_or_printaddr.
(printcmsghdr, printmsghdr, printmmsghdr, decode_mmsg, do_sockname,
sys_recv, sys_recvfrom, sys_recvmsg, do_pipe, print_linger, print_ucred,
print_tpacket_stats, print_icmp_filter, print_getsockopt,
print_group_req, print_tpacket_req, print_packet_mreq,
print_setsockopt): Use printaddr.
(print_mreq, print_mreq6): Use umove_or_printaddr.
2015-07-20 01:42:00 +00:00
b679508f6e Use printpair_int
* evdev.c (repeat_ioctl): Use printpair_int.
* net.c (do_pipe, sys_socketpair): Likewise.
2015-07-09 01:43:44 +00:00
d93c4e80b3 Consistenly use #ifdef to check for AC_DEFINE'd macros
* aio.c (print_common_flags): Use #ifdef in the check for
HAVE_STRUCT_IOCB_U_C_FLAGS.
* defs.h: Use #ifdef in the check for HAVE_LITTLE_ENDIAN_LONG_LONG.
* net.c: Use #ifdef in the check for HAVE_SENDMSG.
* syscall.c (dumpio): Likewise.
* printstat.h (DO_PRINTSTAT): Use #ifdef in checks for
HAVE_STRUCT_STAT_ST_* macros.
* util.c: Use #ifdef in checks for HAVE_SYS_XATTR_H.
2015-06-17 20:09:13 +00:00
fddeeba9b8 net: move fallback definitions of SOL_* constants to xlat/
* net.c: Move definitions of SOL_* constants ...
* xlat/socketlayers.in: ... here.
2015-06-17 19:23:30 +00:00
7bee462a64 net: decode setsockopt() multicast arguments
* configure.ac (AC_CHECK_FUNCS): Add inet_pton.
* net.c (print_mreq, print_mreq6): New functions.
(print_setsockopt): Use them to decode IP_ADD_MEMBERSHIP,
IP_DROP_MEMBERSHIP, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP,
IPV6_JOIN_ANYCAST, and IPV6_LEAVE_ANYCAST.
* tests/ip_mreq.c: New file.
* tests/ip_mreq.expected: Likewise.
* tests/ip_mreq.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ip_mreq.
(TESTS): Add ip_mreq.test.
(EXTRA_DIST): ip_mreq.expected.
* tests/.gitignore: Add ip_mreq.

Based on patch by Ben Noordhuis <info@bnoordhuis.nl>.
2015-06-08 23:02:27 +00:00
ae28093c65 net: factor out interface index printing code
* net.c (print_ifindex): New function.
(printsock) [HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID]: Use it.
2015-06-05 20:13:21 +00:00
3e9d71feaa Introduce memory allocation wrappers
Introduce wrappers to the following functions that do memory allocation:
malloc, calloc, realloc, strdup.

This commit is a follow-up to the related discussions in strace-devel ML:
http://sourceforge.net/p/strace/mailman/message/33618180/
http://sourceforge.net/p/strace/mailman/message/33733470/

* defs.h (xmalloc, xcalloc, xreallocarray, xstrdup): New prototypes.
* xmalloc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* count.c (count_syscall, call_summary_pers): Use xcalloc.
* desc.c (decode_select): Use xmalloc.
* dirent.c (sys_getdents, sys_getdents64): Likewise.
* net.c (sys_recvmmsg): Use xstrdup.
* pathtrace.c (storepath): Use xreallocarray.
(pathtrace_match): Use xmalloc.
* strace.c (die_out_of_memory): Move to xmalloc.c.
(expand_tcbtab): Use xcalloc and xreallocarray.
(startup_child): Use xstrdup.
(init): Use xmalloc, xcalloc, and xstrdup.
* syscall.c (reallocate_qual): Use xreallocarray.
(qualify): Use xstrdup.
* unwind.c (unwind_tcb_init): Use xmalloc.
(build_mmap_cache): Use xcalloc, xreallocarray, and xstrdup.
(get_symbol_name): Use xreallocarray.
(stacktrace_walk, queue_put): Use xmalloc.
* util.c (printstr): Use xmalloc.
* vsprintf.c (strace_vfprintf): Likewise.
2015-05-25 22:25:22 +00:00
a0bd3749fc Declare syscall parsers using SYS_FUNC macro
Introduce SYS_FUNC macro to declare and define all syscall parsers.

* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sys_func.h.
(sys_func.h): New rule.
* defs.h (SYS_FUNC_NAME, SYS_FUNC): New macros.
* linux/syscall.h: Include "sys_func.h".
[NEED_UID16_PARSERS]: Use SYS_FUNC to declare uid16 syscall parsers.
Remove other declarations.
* linux/alpha/syscallent.h (160, 161): Add sys_ prefix to osf_statfs
and osf_fstatfs syscall parsers.
* *.c: Use SYS_FUNC to define syscall parsers.
2015-04-07 11:22:49 +00:00
78ed3f3558 alpha, ia64, sh, sparc, sparc64: fix pipe and pipe2 syscalls decoding
Fix pipe syscall decoding on alpha.
Fix pipe2 syscall decoding on ia64, sh, sparc, and sparc64.

* configure.ac (AC_CHECK_FUNCS): Add pipe2.
* defs.h [ALPHA || IA64 || SH || SPARC || SPARC64] (HAVE_GETRVAL2):
Define.
* net.c (do_pipe): Check HAVE_GETRVAL2 instead of architecture macros.
Do not use getrval2 for pipe2 decoding.
Print address if umove call fails.
* syscall.c (getrval2): Check HAVE_GETRVAL2 instead of architecture
macros.  Implement for [ALPHA].
* tests/pipe.c: New file.
* tests/pipe.expected: New file.
* tests/pipe.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add pipe.
(TESTS): Add pipe.test.
(EXTRA_DIST): Add pipe.expected.
* tests/.gitignore: Add pipe.
2015-03-23 03:16:51 +00:00
Denys Vlasenko
7e69ed98cd Change last parameter of umoven() from char* to void*
Saves tons of casts.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2015-03-21 19:50:53 +01:00
3910d0f67c print_setsockopt: fix fall-through bug in SOL_IP switch case
This fixes the bug introduced by commit v4.9-250-ga0a4909.

* net.c (print_setsockopt): Separate SOL_IP case from SOL_PACKET.

Reported-by: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-08 01:19:06 +00:00
f362a33660 net.c: remove unused HAVE_SIN6_SCOPE_ID_LINUX-based code
The AC_SIN6_SCOPE_ID autoconf macro that was able to define
HAVE_SIN6_SCOPE_ID_LINUX was removed by commit v4.4-98-g64f793a.

* net.c [HAVE_SIN6_SCOPE_ID_LINUX]: Remove.
2015-01-31 01:14:39 +00:00
d0dceaf0ff printsock: do not fetch sockaddr.sa_data twice
* net.c (printsock): Print addrbuf.sa.sa_data using print_quoted_string.
2015-01-30 13:36:49 +00:00
a0a4909988 setsockopt: add decoding of MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP
* net.c (print_group_req): New function.
(print_setsockopt): Use it.
2015-01-30 01:55:20 +00:00
f57bd11eb0 printsock: print the whole sockaddr_un.sun_path
* net.c (printsock): If sockaddr_un.sun_path is not NUL-terminated,
do not omit the last byte of sockaddr_un.sun_path array.
2015-01-29 15:19:21 +00:00
d9177dfc12 printsock: do not fetch sockaddr_un.sun_path twice
* net.c (printsock): Print addrbuf.sau.sun_path using
print_quoted_string.
2015-01-29 07:34:40 +00:00
6d31c7a6a9 net: define all SOL_* constants
Ensure that all known SOL_* constants are defined.
Sync the list of known SOL_* constants with linux/socket.h.

* net.c: Provide definitions for all SOL_* constants.
Remove all SOL_* preprocessor conditionals.
(socketlayers): Disconnect from inet_protocols.
* xlat/socketlayers.in: Remove SOL_ICMP, add SOL_ALG and SOL_NFC.
2015-01-29 05:21:08 +00:00
02f2f091d5 setsockopt: decode PACKET_ADD_MEMBERSHIP
* xlat/packet_mreq_type.in: New file.
* net.c: Include "xlat/packet_mreq_type.h".
(print_packet_mreq): New function.
(print_setsockopt): Use it.
2015-01-29 03:35:11 +00:00
0509c8ed6d getsockopt, setsockopt: do not decode structures in non-verbose mode
Move the code that is common between getsockopt and setsockopt parsers
to a separate function.
Move printers specific to getsockopt and setsockopt to separate
functions, choose appropriate parsers depending on verbose mode.
Move parsers of specific socket options to separate functions.

* net.c (printicmpfilter): Rename to print_icmp_filter.
(printsockopt): Remove.
(print_sockopt_fd_level_name, print_linger, print_ucred,
print_tpacket_stats, print_getsockopt, print_tpacket_req,
print_packet_mreq, print_setsockopt): New functions.
(sys_getsockopt, sys_setsockopt): Use them.
2015-01-29 03:35:07 +00:00
00244b94bb sendmsg: do not decode msghdr in non-verbose mode
* net.c (printmsghdr): Do not decode struct msghdr in non-verbose mode.
2015-01-28 01:52:25 +00:00
0e9d594caa printsock: quote network interface names
* net.c (printsock): Print network interface names returned by
if_indextoname() using print_quoted_string.
2015-01-26 19:08:37 +00:00
513e96eb94 Rework string_quote API
string_quote() has proven to be too hard to use, replace it with
print_quoted_string() that does memory allocation and prints the result.

* defs.h (string_quote): Remove.
(QUOTE_0_TERMINATED, QUOTE_OMIT_LEADING_TRAILING_QUOTES): New macros.
(print_quoted_string): New prototype.
* util.c (string_quote): Make static; take "style" flags instead
of "len", treat QUOTE_0_TERMINATED style flag as former (len == -1);
add QUOTE_OMIT_LEADING_TRAILING_QUOTES style flag support.
(ALLOCA_CUTOFF, use_alloca): New macros.
(print_quoted_string): New function.
(printpathn, printstr): Update to new API.
* loop.c (loop_ioctl): Likewise.
* mtd.c (ubi_ioctl): Likewise.
* net.c (print_scm_security): Likewise.
* socketutils.c (unix_parse_response): Likewise.
2015-01-26 15:58:18 +00:00
b85a7f3b95 Impove struct cmsghdr decoding
Print all cmsghdr structures in msg_control array,
not just the first one.
Change output format to be consistent with other parts of strace
where structures and arrays are printed.
Implement decoder for SCM_SECURITY message type.

* net.c (print_scm_rights, print_scm_creds, print_scm_security):
New functions.
(printcmsghdr): Use them.  Iterate over all members of the array.
* xlat/scmvals.in: Add SCM_SECURITY.
* tests/scm_rights.c (main): Pass one more descriptor to the receiver.
Set SO_PASSCRED on the receiver part.  Reserve enough space to receive
SCM_CREDENTIALS and SCM_RIGHTS.
* tests/scm_rights-fd.test: Update.
2015-01-24 15:54:33 +00:00
05884d866c Fix ILP32 personality struct cmsghdr decoding on LP64 architectures
* net.c (union_cmsghdr): New union.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (cmsghdr32): New structure.
(printcmsghdr): Properly handle the case of current_wordsize < sizeof(long).
2015-01-24 03:39:30 +00:00
d9f7e7a439 Fix build on systems that lack NETLINK_SOCK_DIAG definition
NETLINK_INET_DIAG was introduced in linux v2.6.14,
NETLINK_SOCK_DIAG was added much later in linux v3.3.

* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]
(NETLINK_SOCK_DIAG): Define.
* socketutils.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.
2015-01-09 03:05:56 +00:00
37548c4afc Alias sys_getpeername to sys_getsockname
Since parsers for getpeername and getsockname syscalls are identical,
replace sys_getpeername with an alias to sys_getsockname.

* linux/dummy.h (sys_getpeername): Alias to sys_getsockname.
* linux/syscall.h (sys_getpeername): Remove.
* net.c (sys_getpeername): Remove.
2014-12-02 21:36:04 +00:00
b2fa2beedc Include <sys/uio.h> unconditionally
Since <sys/uio.h> is standardized by POSIX and is present in all
available versions of glibc, it's safe to assume that any usable
libc implementation provides this header file.

* configure.ac (AC_CHECK_HEADERS): Remove sys/uio.h.
* io.c: Include <sys/uio.h> unconditionally.
(tprint_iov_upto, tprint_iov, sys_readv, sys_writev,
print_llu_from_low_high_val, sys_preadv, sys_pwritev): Define
unconditionally.
* net.c: Include <sys/uio.h> unconditionally.
* util.c: Include <sys/uio.h> unconditionally.
(dumpiov): Define unconditionally.
2014-11-21 20:46:16 +00:00
Masatake YAMATO
a807dceca5 Add functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg
This patch is similar to what I did in commit
02f9f6b386.
That commit was for sendmsg and recvmsg system calls.
This one is for sendmmsg and recvmmsg system calls.

* defs.h (dumpiov_in_mmsghdr): New declaration.
* net.c (extractmmsghdr): New function derived from printmmsghdr.
(printmmsghdr): Use it.
(dumpiov_in_mmsghdr): New function.
* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_mmsghdr
for recvmmsg and sendmmsg syscalls.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-11 15:44:24 +00:00
Masatake YAMATO
caf6a438f9 Use the definition of struct mmsghdr if it is defined in build environment
mmsghrd structure type is defined locally in printmmsghdr function.

However, more functions will refer the definition in modifications for
supporting "-e write=set" and "-e read=set" option for sendmmsg and
recvmmsg system calls.

After this change, the system definition of struct mmsghdr will be used
if configure reports it is available, falling back to the old local
definition.

* configure.ac (AC_CHECK_TYPES): Add struct mmsghdr.
* net.c [!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
(printmmsghdr): Use previously defined struct mmsghdr.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-11-11 15:42:07 +00:00
Masatake YAMATO
b248543be9 Introduce a separate function to copy from msghdr32 to msghdr
This patch is an initial step for supporting "-e write=set" and
"-e read=set" option for sendmmsg and recvmmsg system calls.

Coverting a data of msghdr32 to msghdr is needed both for
{send,recv}msg and {send,recv}mmsg to decode parameters.
To share the copying code in both decoders, a separate
function named copy_from_msghdr32 is introduced.

* net.c [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]
(copy_from_msghdr32): New function.
(extractmsghdr) [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]: Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-11-11 15:41:37 +00:00
Lubomir Rintel
c400a1c70e Dump details for Bluetooth socket operations
* configure.ac (AC_CHECK_HEADERS): Add bluetooth/bluetooth.h.
* xlat/bt_protocols.in: New file.
* net.c [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include bluetooth
headers.
[PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
(printsock) [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Dump details
for AF_BLUETOOTH sockets.
(sys_socket) [PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Decode
protocol for PF_BLUETOOTH sockets.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-04 15:38:39 +00:00
Masatake YAMATO
02f9f6b386 Add a function for dumping iovec in msghdr used in sendmsg and recvmsg
Here is an example session:

    $ ./strace -e write=all ip link change dev enp0s25 mtu 1501 > /dev/null
    sendmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"(...
     * 40 bytes in buffer 0
     | 00000  28 00 00 00 10 00 05 00  d0 d9 aa 53 00 00 00 00  (..........S.... |
     | 00010  00 00 00 00 02 00 00 00  00 00 00 00 00 00 00 00  ................ |
     | 00020  08 00 04 00 dd 05 00 00                           ........         |
    ...

    $ ./strace -e read=all ip link show > /dev/null
    recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"...
     * 8192 bytes in buffer 0
     | 00000  34 00 00 00 02 00 00 00  00 00 00 00 ff 23 00 00  4............#.. |
     | 00010  ff ff ff ff 20 00 00 00  10 00 05 00 00 00 00 00  .... ........... |
    ...

* defs.h (dumpiov_in_msghdr): New prototype.
* net.c (extractmsghdr): New function derived from printmsghdr.
(printmsghdr): Use extractmsghdr.
(dumpiov_in_msghdr): New function.
* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_msghdr for recvmsg
and sendmsg syscalls.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-01 01:46:06 +00:00
3ed5d02183 Fix compilation warnings reported by gcc -Wsign-compare
* configure.ac (gl_WARN_ADD): Add -Wsign-compare.
* defs.h (struct tcb): Change 'currpers' type to unsigned.
(struct xlat): Change 'val' type to unsigned
(signame): Add 'const' qualifier to its argument.
(xlookup, printxval): Add 'const' qualifier to the 2nd argument and
change its type to unsigned.
(printpathn): Change the 3rd argument type to unsigned.
(ioctl_lookup): Change 1st argument type to unsigned.
* count.c (call_summary_pers, call_summary): Change 'i' type to unsigned.
* file.c (print_xattr_list): Fix comparisons between signed and unsigned
long values.
* ioctl.c (compare): Fix cast.
(ioctl_lookup): Change 1st argument type to to unsigned.
(ioctl_next_match): Change 'code' type to unsigned.
* mem.c (sys_move_pages): Change 'i' type to unsigned.
* mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned.
Print 'i' using %u format string.
* process.c (sys_prctl): Change 'i' type to unsigned.
(printargv): Change 'n' type to unsigned.
(sys_ptrace): Change 'addr' type to unsigned.
* scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument
and change its type to unsigned.  Change 'i' and 'allocated' types
to unsigned.
* signal.c (signame): Add 'const' qualifier to its argument.
Fix comparisons between signed and unsigned values.
(sprintsigmask_n, printsiginfo): Fix comparisons between signed and
unsigned values.
* sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned.
* strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned.
(detach): Change 'sig' type to unsigned.
(startup_attach): Change 'tcbi' type to unsigned.
(startup_child): Change 'm', 'n', and 'len' types to unsigned.
(init): Use new variable to iterate 'tcbtab'.
(pid2tcb): Change 'i' type to unsigned.
(cleanup): Change 'i' and 'sig' types to unsigned.
* syscall.c (update_personality): Change 'personality' argument type
to unsigned.
(struct qual_options): Change 'bitflag' type to unsigned.
(reallocate_qual): Add 'const' qualifier to its argument and change its
type to unsigned.
(qualify_one): Change 'n' and 'bitflag' arguments types to unsigned.
Add 'const' qualifier to 'n', 'not', and 'pers' arguments.
Change 'p' type to signed int.
(qual_syscall): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'p' type to signed int.
(qual_signal): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'i' type to unsigned.
(qual_desc): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
(qualify): Change 'i' type to unsigned.
(get_scno): Change 'currpers' type to unsigned.
Fix a comparison between signed and unsigned values.
* system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned.
Fix comparisons between signed and unsigned values.
* util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument
and change its type to unsigned.
(printuid): Fix a comparison between signed and unsigned values.
(printpathn): Change 'n' argument type to unsigned.
(printstr): Change 'size' type to unsigned.
Fix a comparison between signed and unsigned values.
(setbpt): Change 'i' type to unsigned.
* net.c (printsock): Silence a compilation warning.
* reboot.c (sys_reboot): Likewise.
2014-09-17 19:18:18 +00:00
1e42f2dbe7 tprint_sock_type: remove unused parameter
* net.c (tprint_sock_type): Remove unused parameter 'tcp'.
(sys_socket, sys_socketpair): Update callers.
2014-09-10 22:29:59 +00:00
1306365291 printsock: fix decoding of unrecognized AF_PACKET packet types
* net.c (printsock): Fix fallback string for AF_PACKET packet types.
2014-09-10 22:29:58 +00:00
15114ec215 Decode file descriptors returned by accept and accept4 syscalls
* net.c (do_accept): Rename to do_sockname.
(sys_accept, sys_accept4): Update callers, return RVAL_FD.
(sys_getsockname, sys_getpeername): Call do_sockname directly.
* tests/net-fd.test: Update.
2014-08-06 16:49:59 +00:00
d35bdcad13 Compress blank lines
Suppress empty lines left after automated xlat conversion.
2014-05-30 22:10:21 +00:00
0ed617bd66 Generate xlat/*.in files
Automatically convert xlat structures from *.c files to xlat/*.in files
using "./generate_xlat_in.sh *.c" command.
2014-05-30 21:40:03 +00:00
f23b097fc5 Decode file descriptors passed via SCM_RIGHTS control messages
* net.c (printcmsghdr): Print descriptors from SCM_RIGHTS control
messages using printfd.
* tests/scm_rights.c: New file.
* tests/scm_rights-fd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add scm_rights.
(TESTS): Add scm_rights-fd.test.
* tests/.gitignore: Add scm_rights and uio.
2014-05-30 00:20:53 +00:00
Masatake YAMATO
2394a3d0e5 Decode protocol argument for PF_NETLINK sockets
* net.c (protocols): Rename to inet_protocols.
[PF_NETLINK] (netlink_protocols): New xlat structure.
(sys_socket): Rename protocols to inet_protocols.
[PF_NETLINK]: Decode protocol argument using netlink_protocols.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2014-03-11 22:56:42 +00:00
033fb910a2 Cleanup socketpair decoding
The only supported domain for socketpair syscall is AF_UNIX, so
no decoding related to other domains is required for socketpair.

* net.c (sys_socketpair): Remove support for PF_INET and PF_IPX domains,
print the protocol argument as is.
2014-03-11 22:50:39 +00:00
5945273533 Use XLAT_END macro
Automatically update all xlat structures using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/
2014-02-05 02:28:18 +00:00
bce0cc6a2d Use XLAT macro
Automatically convert all xlat structures to XLAT form
using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
2014-02-05 01:33:50 +00:00