Commit Graph

15 Commits

Author SHA1 Message Date
c6782f144a tests: change the license to GPL-2.0-or-later
strace test suite is now provided under the terms of the GNU General
Public License version 2 or later, see tests/COPYING for more details.
2018-12-10 00:00:00 +00:00
5c62e29237 Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-10-30 08:09:10 +00:00
96df4b36f6 Workaround signedness bugs in system NLMSG_OK reported by -Wsign-compare
Introduce a replacement for NLMSG_OK provided by <linux/netlink.h> since
that system macro contains signedness bugs that are not going to be fixed.

* netlink.h: Include <stdbool.h>.
(is_nlmsg_ok): New static inline function.
* socketutils.c (receive_responses): Use it instead of NLMSG_OK.
* tests/netlink_inet_diag.c (check_responses): Likewise.
* tests/netlink_netlink_diag.c (check_responses): Likewise.
* tests/netlink_unix_diag.c (check_responses): Likewise.

Closes: https://github.com/strace/strace/issues/79
2018-09-16 21:32:37 +00:00
Eugene Syromyatnikov
dc3dfc68b4 Update copyright headers
Headers updated automatically with

    maint/update_copyright_headers.sh -c
2017-09-05 10:09:10 +02:00
4a2a9a7cb1 Include "netlink.h" instead of <linux/netlink.h>
* net.c: Include "netlink.h" instead of <linux/netlink.h>.
* sockaddr.c: Likewise.
* tests/create_nl_socket.c: Likewise.
* tests/net-sockaddr.c: Likewise.
* tests/netlink_audit.c: Likewise.
* tests/netlink_generic.c: Likewise.
* tests/netlink_inet_diag.c: Likewise.
* tests/netlink_netfilter.c: Likewise.
* tests/netlink_route.c: Likewise.
* tests/netlink_selinux.c: Likewise.
* tests/netlink_xfrm.c: Likewise.
* tests/net-yy-netlink.c: Include "netlink.h" instead
of <linux/netlink.h>, remove fallback definition of NETLINK_SOCK_DIAG.
* tests/netlink_netlink_diag.c: Likewise.
* tests/netlink_protocol.c: Likewise.
* tests/netlink_sock_diag.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.
* tests/nlattr.c: Likewise.
2017-06-25 00:40:29 +00:00
7b6979701b Fix one more code pattern that might break gcc strict aliasing rules
* socketutils.c (receive_responses): Turn static buffer into a union
to avoid breaking of gcc strict aliasing rules.
* tests/netlink_inet_diag.c (check_responses): Likewise.
* tests/netlink_netlink_diag.c (check_responses): Likewise.
* tests/netlink_unix_diag.c (check_responses): Likewise.
2016-05-21 09:33:12 +00:00
fa5e5d9854 tests: do not include <assert.h> unnecessarily
Automatically change tests/*.c files using the following script:

for f in tests/*.c; do
	grep -q '\<assert(' "$f" ||
		sed -i '/# *include *<assert\.h>/d' "$f"
done
2016-04-21 22:05:57 +00:00
71fe62e6b7 Replace PF_* constants with AF_*
AF_* constants appear to be more standardized, and in practice there's
always a one to one relationship between AF_* and PF_*, so let's
use AF_* instead of PF_*.

* xlat/domains.in: Remove.
* net.c: Do not define PF_UNSPEC.  Stop including "xlat/domains.h".
Replace PF_* with AF_*.  Replace domains with addrfams.
* tests/inet-cmsg.c: Replace PF_INET with AF_INET.
* tests/net-yy-inet.c: Likewise.
* tests/netlink_inet_diag.c: Likewise.
* tests/net-accept-connect.c: Replace PF_LOCAL with AF_LOCAL.
* tests/net-y-unix.c: Likewise.
* tests/net-yy-unix.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.
* tests/net.expected: Replace PF_ with AF_.
2016-04-04 01:35:28 +00:00
ab26390287 alpha: fix SOCK_DIAG_BY_FAMILY tests
This complements commit v4.9-368-g301c65c.

* tests/netlink_inet_diag.c (check_responses): Align "buf"
on sizeof(long) boundary.
* tests/netlink_unix_diag.c (check_responses): Likewise.
2016-03-15 02:54:38 +00:00
3c86e0ea5d Robustify netlink response parsers
* socketutils.c (inet_parse_response, unix_parse_response): Change
return type from bool to int, return -1 on all parse errors except
inode mismatch.
(receive_responses): Stop on the first nlmsg_type that is not
SOCK_DIAG_BY_FAMILY, also stop when the parser returns -1.
* tests/netlink_inet_diag.c (check_responses): Stop on short messages,
on first nlmsg_type that is not SOCK_DIAG_BY_FAMILY, print more verbose
diagnostics for NLMSG_ERROR.
* tests/netlink_unix_diag.c (check_responses): Likewise.
2016-02-03 12:43:17 +00:00
285c3f453a tests/netlink_inet_diag.c: use libtests
* tests/netlink_inet_diag.c (send_query, check_responses, main):
Use perror_msg_and_skip.
2016-01-06 15:53:45 +00:00
38a34c9349 Add copyright headers to some files which lack them
Before this change, all files that exist since 20th century had
copyright headers, while most files that appeared later didn't.  This
change fixes the inconsistency by adding missing copyright headers.

It doesn't mean that copyright headers became maintained.  In my view,
git history provides much better information on this subject and is much
more accurate than copyright headers.
2015-12-17 17:56:48 +00:00
6add1b09d6 tests: skip netlink based tests when resources are not available
* tests/netlink_inet_diag.c (main): Return 77 if socket, bind,
or listen syscall fail.
* tests/netlink_unix_diag.c (main): Likewise.
2015-03-18 22:39:20 +00:00
af534b8d7a Consistently use C99 designated initializers in the new netlink code
* socketutils.c (send_query, receive_responses): Use designated
initializers for sockaddr_nl, nlmsghdr, and inet_diag_req_v2 structures.
* tests/netlink_inet_diag.c (send_query, check_responses): Likewise.
2014-11-21 19:59:16 +00:00
fdfa72276a tests: add a test for -yy option
* tests/net-yy.test: New test.
* tests/inet-accept-connect-send-recv.c: New file.
* tests/netlink_inet_diag.c: Likewise.
* tests/net-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Likewise.
* tests/.gitignore: Add inet-accept-connect-send-recv,
netlink_inet_diag, *.tmp-*, and *.tmp.*.
* tests/Makefile.am (check_PROGRAMS): Add inet-accept-connect-send-recv
and netlink_inet_diag.
(TESTS): Add net-yy.test.
(EXTRA_DIST): Add net-yy-accept.awk and net-yy-connect.awk.
2014-09-23 01:42:07 +00:00