Commit Graph

326 Commits

Author SHA1 Message Date
JingPiao Chen
69c68ef5bf Workaround historic linux/netfilter/xt_osf.h deficiencies
When using linux kernel headers without commit v4.5-rc1~128^2~115^2~22
("netfilter: fix include files for compilation"), both <linux/ip.h>
and <linux/tcp.h> have to be included before <linux/netfilter/xt_osf.h>.

* configure.ac (AC_CHECK_HEADERS): Include <linux/ip.h>
and <linux/tcp.h> when checking for linux/netfilter/xt_osf.h header.
* tests/nfnetlink_osf.c: Include <linux/ip.h> and <linux/tcp.h>
before <linux/netfilter/xt_osf.h>.
2017-10-14 18:29:51 +00:00
JingPiao Chen
489d8a9564 tests: check decoding of NFNL_SUBSYS_NFT_COMPAT netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nf_tables_compat.h.
* tests/nfnetlink_nft_compat.c: New file.
* tests/gen_tests.in (nfnetlink_nft_compat): New entry.
* tests/pure_executables.list: Add nfnetlink_nft_compat.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
b27bee724d tests: check decoding of NFNL_SUBSYS_NFTABLES netlink message types
* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/nf_tables.h.
* tests/nfnetlink_nftables.c: New file.
* tests/gen_tests.in (nfnetlink_nftables): New entry.
* tests/pure_executables.list: Add nfnetlink_nftables.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
935e0629c5 tests: check decoding of NFNL_SUBSYS_CTHELPER netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_cthelper.h.
* tests/nfnetlink_cthelper.c: New file.
* tests/gen_tests.in (nfnetlink_cthelper): New entry.
* tests/pure_executables.list: Add nfnetlink_cthelper.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
130b1ade11 tests: check decoding of NFNL_SUBSYS_CTNETLINK_TIMEOUT netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_cttimeout.h.
* tests/nfnetlink_cttimeout.c: New file.
* tests/gen_tests.in (nfnetlink_cttimeout): New entry.
* tests/pure_executables.list: Add nfnetlink_cttimeout.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
fa94d0e5e0 tests: check decoding of NFNL_SUBSYS_ACCT netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_acct.h.
* tests/nfnetlink_acct.c: New file.
* tests/gen_tests.in (nfnetlink_acct): New entry.
* tests/pure_executables.list: Add nfnetlink_acct.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
f61c513898 tests: check decoding of NFNL_SUBSYS_IPSET netlink message types
* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/ipset/ip_set.h.
* tests/nfnetlink_ipset.c: New file.
* tests/gen_tests.in (nfnetlink_ipset): New entry.
* tests/pure_executables.list: Add nfnetlink_ipset.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
0d870031b3 tests: check decoding of NFNL_SUBSYS_OSF netlink message types
* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/xt_osf.h.
* tests/nfnetlink_osf.c: New file.
* tests/gen_tests.in (nfnetlink_osf): New entry.
* tests/pure_executables.list: Add nfnetlink_osf.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
ed593fef59 tests: check decoding of NFNL_SUBSYS_ULOG netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_log.h.
* tests/nfnetlink_ulog.c: New file.
* tests/gen_tests.in (nfnetlink_ulog): New entry.
* tests/pure_executables.list: Add nfnetlink_ulog.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
cd02efa8cf tests: check decoding of NFNL_SUBSYS_QUEUE netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_queue.h.
* tests/nfnetlink_queue.c: New file.
* tests/gen_tests.in (nfnetlink_queue): New entry.
* tests/pure_executables.list: Add nfnetlink_queue.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
f2ee2a845e tests: check decoding of NFNL_SUBSYS_CTNETLINK netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_conntrack.h.
* tests/nfnetlink_ctnetlink.c: New file.
* tests/gen_tests.in (nfnetlink_ctnetlink): New entry.
* tests/pure_executables.list: Add nfnetlink_ctnetlink.
* tests/.gitignore: Likewise.
2017-09-24 10:07:57 +00:00
Eugene Syromyatnikov
6eb263c72c kcmp: add KCMP_EPOLL_TFD support
* configure.ac (AC_CHECK_TYPES): Add check for struct kcmp_epoll_slot.
* kcmp.c (SYS_FUNC(kcmp)) <case KCMP_EPOLL_TFD>: Implement idx1/idx2
argument parsing.
* tests/kcmp.c: Update test.
* xlat/kcmp_types.in (KCMP_EPOLL_TFD): New entry.
2017-09-17 12:04:11 +00:00
Eugene Syromyatnikov
9acc241775 tests/kcmp: use <linux/kcmp.h> if it is available
I see it as a good idea to stick to system headers whenever possible
in order to also check for possible discrepancies between strace's
internal definitions and definitions present in the system headers.

* configure.ac (AC_CHECK_HEADERS): Add linux/kcmp.h.
* tests/kcmp.h [HAVE_LINUX_KCMP_H]: Include <linux/kcmp.h>,
do not define KCMP_FILE and KCMP_SYSVSEM.
2017-09-17 12:04:11 +00:00
JingPiao Chen
8229db741f rtnl_mdb: decode br_port_msg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for struct br_mdb_entry
in <linux/if_bridge.h>.
(AC_CHECK_MEMBERS): Check for flags and vid fields in struct br_mdb_entry.
* rtnl_mdb.c: Include "xlat/mdb_flags.h", "xlat/mdb_states.h",
"xlat/rtnl_mdba_mdb_attrs.h", "xlat/rtnl_mdba_mdb_eattr_attrs.h",
"xlat/rtnl_mdba_mdb_entry_attrs.h" ,"xlat/rtnl_mdba_router_attrs.h"
and "xlat/rtnl_mdba_router_pattr_attrs.h".
(decode_mdba_mdb_entry_info, decode_mdba_mdb_entry,
decode_mdba_mdb, decode_multicast_router_type,
decode_mdba_router_port, decode_mdba_router): New functions.
(mdba_mdb_eattr_nla_decoders, mdba_mdb_entry_nla_decoders,
mdba_mdb_nla_decoders, mdba_router_pattr_nla_decoders,
mdba_router_nla_decoders, br_port_msg_nla_decoders): New arrays.
(decode_br_port_msg): Use br_port_msg_nla_decoders.
* xlat/mdb_flags.in: New file.
* xlat/mdb_states.in: Likewise.
* xlat/multicast_router_types.in: Likewise.
* xlat/rtnl_mdba_mdb_attrs.in: Likewise.
* xlat/rtnl_mdba_mdb_eattr_attrs.in: Likewise.
* xlat/rtnl_mdba_mdb_entry_attrs.in: Likewise.
* xlat/rtnl_mdba_router_attrs.in: Likewise.
* xlat/rtnl_mdba_router_pattr_attrs.in: Likewise.
2017-09-17 12:04:11 +00:00
JingPiao Chen
d3cbd56ef3 rtnl_tc: decode tcmsg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for gnet_stats_basic,
gnet_stats_queue, gnet_stats_rate_est,
and gnet_stats_rate_est64 structures in <linux/gen_stats.h>.
And check for struct tc_sizespec in <linux/pkt_sched.h>.
* nlattr.h (tc_stats): New prototype.
* rtnl_tc.c: Include <linux/gen_stats.h>, <linux/pkt_sched.h>,
"xlat/rtnl_tca_stab_attrs.h" and "xlat/rtnl_tca_stats_attrs.h".
(decode_tc_stats, decode_tc_estimator, decode_gnet_stats_basic,
decode_gnet_stats_rate_est, decode_gnet_stats_queue,
decode_gnet_stats_rate_est64, decode_nla_tc_stats,
decode_tc_sizespec, print_stab_data, decode_tca_stab_data,
decode_tca_stab): New functions.
(tca_stats_nla_decoders, tca_stab_nla_decoders,
tcmsg_nla_decoders): New arrays.
(decode_tcmsg): Use tcmsg_nla_decoders.
* xlat/rtnl_tca_stab_attrs.in: New file.
* xlat/rtnl_tca_stats_attrs.in: Likewise.
2017-09-07 11:35:04 +00:00
Eugene Syromyatnikov
db70fcf6da configure.ac: specify minimal GNU Automake version
In order to provide better diagnostics.

* configure.ac (AM_INIT_AUTOMAKE): Specify minimal GNU Automake version as
1.13 due to usage of AM_EXTRA_RECURSIVE_TARGETS macro.

Closes: https://github.com/strace/strace/issues/11
2017-09-04 23:21:14 +02:00
JingPiao Chen
38042986d9 rtnl_link: decode more ifinfomsg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for struct ifla_port_vsi
in <linux/if_link.h>.
* rtnl_link.c: Include "xlat/rtnl_ifla_info_attrs.h",
"xlat/rtnl_ifla_port_attrs.h", "xlat/rtnl_ifla_port_attrs.h",
"xlat/rtnl_ifla_xdp_attrs.h", and "xlat/xdp_flags.h".
(decode_ifla_linkinfo, decode_ifla_port_vsi,
decode_ifla_port, decode_ifla_vf_ports,
decode_ifla_xdp_flags, decode_ifla_xdp): New functions.
(ifla_linkinfo_nla_decoders, ifla_port_nla_decoders,
ifla_vf_port_nla_decoders, ifla_xdp_nla_decoders): New arrays.
(ifinfomsg_nla_decoders) <IFLA_LINKINFO>: Use decode_ifla_linkinfo.
<IFLA_VF_PORTS>: Use decode_ifla_vf_ports.
<IFLA_PORT_SELF>: Use decode_ifla_port.
<IFLA_XDP>: Use decode_ifla_xdp.
* xlat/rtnl_ifla_info_attrs.in: New file.
* xlat/rtnl_ifla_port_attrs.in: Likewise.
* xlat/rtnl_ifla_vf_port_attrs.in: Likewise.
* xlat/rtnl_ifla_xdp_attrs.in: Likewise.
* xlat/xdp_flags.in: Likewise.
2017-09-03 15:39:24 +00:00
Eugene Syromyatnikov
46a4dcf4c3 keyctl: add support for KDF parameters decoding in KEYCTL_DH_COMPUTE
* fetch_struct_keyctl_kdf_params.c: New file.
* keyctl_kdf_params.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* configure.ac: Add check for struct keyctl_kdf_params presence in
<linux/keyctl.h>.
* defs.h (struct strace_keyctl_kdf_params): Add forward declaration.
* keyctl.c (keyctl_dh_compute): Add new parameter kdf_addr, print it
on exiting.
(SYS_FUNC(keyctl)) <case KEYCTL_DH_COMPUTE>: Pass arg5 to
keyctl_dh_compute.
* tests/keyctl.c: Include assert.h.
(struct keyctl_kdf_params) [!HAVE_STRUCT_KEYCTL_KDF_PARAMS]: New
definition.
(STR32): New definition, copied from ioctl_dm.c.
(append_str, kckdfp_to_str): New functions.
(main): Update expected output, add checks for struct keyctl_kdf_params
decoding.
2017-09-02 21:48:14 +00:00
JingPiao Chen
496a12551c rtnl_link: decode IFLA_PROTINFO netlink attribute of ifinfomsg
* configure.ac (AC_CHECK_TYPES): Check for ifla_bridge_id
and rtnl_link_stats64 structures in <linux/if_link.h>.
* rtnl_link.c: Include "xlat/rtnl_ifla_brport_attrs.h".
(decode_ifla_bridge_id, decode_ifla_protinfo): New functions.
(ifla_brport_nla_decoders): New array.
(ifinfomsg_nla_decoders) <IFLA_PROTINFO>: Use decode_ifla_protinfo.
* xlat/rtnl_ifla_brport_attrs.in: New file.
2017-09-01 08:41:08 +00:00
JingPiao Chen
bbfc46d638 rtnl_neightbl: decode ndtmsg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for ndt_config
and ndt_stats structures in <linux/neighbour.h>.
(AC_CHECK_MEMBERS): Check for ndts_table_fulls field in struct ndt_stats.
* rtnl_neightbl.c: Include "xlat/rtnl_neightbl_parms_attrs.h".
(decode_ndt_config, decode_ndta_parms, decode_ndta_parms): New functions.
(ndt_parms_nla_decoders, ndtmsg_nla_decoders): New arrays.
(decode_ndtmsg): Use ndtmsg_nla_decoders.
* xlat/rtnl_neightbl_parms_attrs.in: New file.
2017-09-01 08:41:08 +00:00
JingPiao Chen
b9a437c147 rtnl_rule: decode fib_rule_hdr netlink attributes
* configure.ac (AC_CHECK_FUNCS): Add be64toh.
(AC_CHECK_TYPES): Check for struct fib_rule_uid_range
in <linux/fib_rules.h>.
* nlattr.c: Include <endian.h>.
(decode_nla_be64): New function.
* nlattr.h (decode_nla_be64): New prototype.
* rtnl_rule.c (decode_rule_addr,
decode_fib_rule_uid_range): New functions.
(fib_rule_hdr_nla_decoders): New array.
(decode_fib_rule_hdr): Use it.
2017-08-29 15:13:12 +08:00
JingPiao Chen
df87f17101 rtnl_link: decode ifinfomsg netlink attributes
* configure.ac (AC_CHECK_HEADERS): Add linux/if_link.h.
(AC_CHECK_TYPES): Check for struct rtnl_link_stats64
in <linux/if_link.h>.
(AC_CHECK_MEMBERS): Check for rx_nohandler field
in struct rtnl_link_stats/rtnl_link_stats64.
* rtnl_link.c: Include <linux/if_link.h>.
(decode_rtnl_link_stats, decode_rtnl_link_ifmap,
decode_rtnl_link_stats64): New functions.
(ifinfomsg_nla_decoders): New array.
(decode_ifinfomsg): Use it.
2017-08-28 10:41:54 +00:00
JingPiao Chen
e8a856f4bd rtnl_route: decode rtmsg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for
rta_mfc_stats and rtvia structures in <linux/rtnetlink.h>.
* nlattr.c (decode_nla_ifindex): New function.
* nlattr.h (decode_nla_ifindex): New prototype.
* rtnl_route.c (decode_route_addr, decode_rta_metrics,
decode_rta_multipath, decode_rta_cacheinfo,
decode_rta_mfc_stats, decode_rtvia,
decode_rta_encap_type): New functions.
(rta_metrics_nla_decoders, rtmsg_nla_decoders): New arrays.
(decode_rtmsg): Use rtmsg_nla_decoders.
* xlat/lwtunnel_encap_types.in: New file.
* xlat/route_nexthop_flags.in: Likewise.
* xlat/rtnl_rta_metrics_attrs.in: Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-26 16:45:18 +00:00
dac32d406f configure: cleanup struct statfs/statfs64 member checks
* configure.ac <AC_CHECK_TYPES([struct statfs])>: Merge several
AC_CHECK_MEMBERS checks of struct statfs members into a single check.
<AC_CHECK_TYPES([struct statfs64])>: Likewise, for checks
of struct statfs64 members.
2017-08-17 12:43:18 +00:00
JingPiao Chen
ca2e93ec05 configure.ac: remove redundant linux/dcbnl.h header check
* configure.ac (AC_CHECK_HEADERS): Remove linux/dcbnl.h.
* rtnl_dcb.c: Replace HAVE_LINUX_DCBNL_H with HAVE_STRUCT_DCBMSG.
* tests/netlink_route.c: Likewise.
2017-08-15 09:13:19 +00:00
JingPiao Chen
063ff93846 netlink: add a basic rtnetlink parser of mdb messages
* rtnl_mdb.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_br_port_msg): New prototype.
* configure.ac (AC_CHECK_TYPES): Check for struct br_port_msg
in <linux/if_bridge.h>.
* netlink_route.c (route_decoders): Add RTM_DELMDB, RTM_GETMDB,
and RTM_NEWMDB.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:59 +00:00
JingPiao Chen
b51ed22cee netlink: add a basic rtnetlink parser of netconf messages
* rtnl_netconf.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_netconfmsg): New prototype.
* configure.ac (AC_CHECK_TYPES): Check for struct netconfmsg
in <linux/netconf.h>.
* netlink_route.c (route_decoders): Add RTM_GETNETCONF
and RTM_NEWNETCONF.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:51 +00:00
JingPiao Chen
b658e89812 netlink: add a basic rtnetlink parser of dcb messages
* rtnl_dcb.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_dcbmsg): New prototype.
* configure.ac (AC_CHECK_HEADERS): Add linux/dcbnl.h.
(AC_CHECK_TYPES): Check for struct dcbmsg in <linux/dcbnl.h>.
* netlink_route.c (route_decoders): Add RTM_GETDCB and RTM_SETDCB.
* xlat/dcb_commands.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:44 +00:00
JingPiao Chen
e14b4df304 netlink: add a basic rtnetlink parser of addrlabel messages
* rtnl_addrlabel.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_ifaddrlblmsg): New prototype.
* configure.ac (AC_CHECK_TYPES): Check for struct ifaddrlblmsg
in <linux/if_addrlabel.h>.
* netlink_route.c (route_decoders): Add RTM_DELADDRLABEL,
RTM_GETADDRLABEL, and RTM_NEWADDRLABEL.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:16 +00:00
JingPiao Chen
8f3b3e6578 netlink: add a basic rtnetlink parser of neigh messages
* rtnl_neigh.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_ndmsg, decode_rtm_getneigh): New prototypes.
* configure.ac (AC_CHECK_HEADERS): Add linux/neighbour.h.
* netlink_route.c (route_decoders): Add RTM_DELNEIGH, RTM_DELNEIGH,
and RTM_NEWNEIGH.
* xlat/nda_types.in: New file.
* xlat/neighbor_cache_entry_flags.in: Likewise.
* xlat/neighbor_cache_entry_states.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:07:07 +00:00
JingPiao Chen
a0d3f258d0 netlink: add a basic rtnetlink parser of rule messages
* defs.h (routing_table_ids): New xlat prototype.
* rtnl_rule.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (ip_type_of_services, routing_table_ids): New xlat prototypes.
* netlink_route.h (decode_fib_rule_hdr): New prototype.
* configure.ac (AC_CHECK_HEADERS): Add linux/fib_rules.h.
* netlink_route.c (route_decoders): Add RTM_DELRULE, RTM_GETRULE,
and RTM_NEWRULE.
* xlat/fib_rule_actions.in: New file.
* xlat/fib_rule_flags.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:06:59 +00:00
JingPiao Chen
3226d22ffc netlink: add a basic rtnetlink parser of addr messages
* rtnl_addr.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Add linux/if_addr.h.
* netlink_route.h (decode_ifaddrmsg): New prototype.
* netlink_route.c (route_decoders): Add RTM_DELADDR,
RTM_GETADDR, RTM_GETANYCAST, RTM_GETMULTICAST, and RTM_NEWADDR.
* xlat/ifaddrflags.in: New file.
* xlat/routing_scopes.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-13 23:01:46 +00:00
Eugene Syromyatnikov
23bd66bfee Generate date for the man page
* Makefile.am (dist-hook): Add .strace.1.in.date generation.
* strace.spec.in (%setup): Likewise.
* configure.ac (manpage_date): New m4 define.
(MANPAGE_DATE): New define/subst.
* strace.1 (.TH): Add manpage date and strace's version.
2017-08-10 21:36:01 +02:00
Eugene Syromyatnikov
4f9270f0c5 Make strace.1 generated
* .gitignore (/strace.1): New entry.
* configure.ac (AC_CONFIG_FILES): Add strace.1.
* strace.1.in: Rename from strace.1.
2017-08-10 21:36:01 +02:00
269e7d2a2c bpf: update BPF_MAP_CREATE decoding
Implement decoding of map_flags and inner_map_fd fields of union bpf_attr
for BPF_MAP_CREATE command introduced by linux kernel commits
v4.6-rc1~91^2~108^2~6 and v4.12-rc1~64^3~373^2~2, respectively.

* configure.ac: Check for inner_map_fd member of union bpf_attr
instead of max_entries.
* xlat/bpf_map_flags.in: New file.
* bpf.c: Include "xlat/bpf_map_flags.h".
(decode_BPF_MAP_CREATE): Add map_flags and inner_map_fd fields
to the structure, print them.
* tests/bpf.c: Update macro guards of BPF_MAP_CREATE decoder test.
(init_BPF_MAP_CREATE_first, print_BPF_MAP_CREATE_attr): Update expected
output.
(init_BPF_MAP_CREATE_attr): Initialize map_flags and inner_map_fd
fields, update offset.
2017-07-27 00:44:31 +00:00
c024f1a60f bpf: update BPF_PROG_LOAD decoding
Implement decoding of union bpf_attr.prog_flags field for BPF_PROG_LOAD
command introduced by linux kernel commit v4.12-rc2~34^2~29^2~2.

* configure.ac: Check for prog_flags member of union bpf_attr
instead of kern_version.
* xlat/bpf_prog_flags.in: New file.
* bpf.c: Include "xlat/bpf_prog_flags.h".
(decode_BPF_PROG_LOAD): Add prog_flags field to the structure, print it.
* tests/bpf.c: Update macro guards of BPF_PROG_LOAD decoder test.
(init_BPF_PROG_LOAD_first, print_BPF_PROG_LOAD_attr): Update expected
output.
(init_BPF_PROG_LOAD_attr): Initialize prog_flags field, update offset.
2017-07-27 00:44:31 +00:00
a1e8d312ed tests: enhance test coverage of bpf syscall parser
* configure.ac: Update union bpf_attr member checks.
* tests/bpf.c: Rewrite.
* tests/bpf-v.c: New file.
* tests/gen_tests.in (bpf-v): New entry.
* tests/pure_executables.list: Add bpf-v.
* tests/.gitignore: Likewise.
2017-07-26 10:28:25 +00:00
4577bb6c89 m4: macroize union bpf_attr field checks
* m4/st_bpf.m4: New file.
* configure.ac: Use st_CHECK_UNION_BPF_ATTR.
2017-07-26 10:28:25 +00:00
JingPiao Chen
e4b90f7bbf netlink: decode NETLINK_CRYPTO crypto_user_alg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for crypto_report_aead,
crypto_report_blkcipher, crypto_report_cipher, crypto_report_hash,
and crypto_report_rng structures in <linux/cryptouser.h>.
* netlink_crypto.c (decode_crypto_report_generic,
decode_crypto_report_hash, decode_crypto_report_blkcipher,
decode_crypto_report_aead, decode_crypto_report_rng,
decode_crypto_report_cipher): New functions.
(crypto_user_alg_nla_decoders): New array.
(decode_crypto_user_alg): Use it.
* xlat/crypto_nl_attrs.in: New file.
* NEWS: Mention this.
2017-07-24 11:18:43 +00:00
6ed39c0fc8 build: add check-valgrind-* to recursive targets
As make -j$N check-valgrind cannot parallelize properly, add
recursive targets for each of valgrind checks.  This way one can run
	for t in $valgrind_enabled_tools; do
		make -k check-valgrind-$n || rc=$?
	done
in $top_builddir.

* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Remove.
* m4/ax_valgrind_check.m4 (AX_VALGRIND_CHECK): Add check-valgrind
and check-valgrind-* to AM_EXTRA_RECURSIVE_TARGETS.
2017-07-20 22:03:31 +00:00
JingPiao Chen
854a12954f tests: check decoding of NETLINK_CRYPTO message types
* configure.ac (AC_CHECK_HEADERS): Add linux/cryptouser.h.
* tests/netlink_crypto.c: New file.
* tests/gen_tests.in (netlink_crypto): New entry.
* tests/pure_executables.list: Add netlink_crypto.
* tests/.gitignore: Likewise.
2017-07-12 21:08:03 +00:00
cc5db1c893 Assume that <linux/filter.h> is always available
<linux/filter.h> was introduced in linux 2.1.75, way before
the minimal kernel version supported by strace.

* configure.ac (AC_CHECK_HEADERS): Remove linux/filter.h.
* seccomp.c: Assume HAVE_LINUX_FILTER_H.
* tests/prctl-seccomp-filter-v.c: Likewise.
* tests/seccomp-filter-v.c: Likewise.
* tests/seccomp-filter.c: Likewise.
2017-07-08 01:49:00 +00:00
340b00aaa7 Use program_invocation_name instead of a local progname variable
Emulate program_invocation_name only if it is not provided by libc.

* configure.ac: Check for program_invocation_name variable.
* strace.c (progname): Remove.
[!HAVE_PROGRAM_INVOCATION_NAME] (program_invocation_name): New variable.
(verror_msg, error_msg_and_help): Use it instead of progname.
(init): Initialize program_invocation_name instead of progname.
2017-07-02 00:31:50 +00:00
Masatake YAMATO
641f3ef7b6 socketutils: build a dynamic xlat table for NETLINK_GENERIC decoding
* configure.ac (AC_CHECK_HEADERS): Add linux/genetlink.h.
* defs.h (genl_families_xlat): New prototype.
* socketutils.c [HAVE_LINUX_GENETLINK_H]: Include <linux/genetlink.h>.
[HAVE_LINUX_GENETLINK_H] (genl_send_dump_families,
genl_parse_families_response): New helper functions.
(genl_families_xlat): New function for building the xlat table
for NETLINK_GENERIC decoding.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-19 21:45:58 +00:00
Masatake YAMATO
d10d64820f Introduce xstrndup function
* configure.ac (AC_CHECK_FUNCS): Add strndup.
* defs.h (xstrndup): New prototype.
* xmalloc.c (xstrndup): New function.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-06-19 21:45:58 +00:00
184e94ba05 Fix a few spacing style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 22:54:08 +00:00
909ffde2d6 tests: guard against missing linux/netfilter/nfnetlink.h
nfnetlink was introduced in linux by commit v2.6.14-rc1~1035^2~217,
add a guard for the case when system headers are not fresh enough.

* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/nfnetlink.h.
* tests/netlink_netfilter.c: Check for HAVE_LINUX_NETFILTER_NFNETLINK_H.
2017-06-05 14:57:29 +00:00
Eugene Syromyatnikov
d86b6bc773 Unify capitalisation of (c) in copyright notices 2017-05-26 19:43:11 +00:00
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
Eugene Syromyatnikov
cd838da878 Derive copyright year from the git commit date
This solves problems like the need to update test suite on every
New Year's Eve.

* Makefile.am (dist-hook): Generate .year.
* copyright-year-gen: New file.
* configure.ac (copyright_year): New m4 variable, defined as the output
of copyright-year-gen script.
(AC_COPYRIGHT): Use it.
(COPYRIGHT_YEAR): New output variable and preprocessor macro.
* strace.c (print_version): Use COPYRIGHT_YEAR.
* strace.spec.in (%prep): Save the value of COPYRIGHT_YEAR autoconf
variable to .year file.
* tests/strace-V.test (config_year): New variable, derived from config.h.
Add sanity checks for $config_year and use it in expected output.

Reported-by: Andreas Schwab <schwab@suse.de>
2017-04-19 08:29:46 +00:00