Commit Graph

10 Commits

Author SHA1 Message Date
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