diff options
| author | Chen Jingpiao <chenjingpiao@gmail.com> | 2018-03-11 20:14:57 +0800 |
|---|---|---|
| committer | Dmitry V. Levin <ldv@altlinux.org> | 2018-03-11 15:35:19 +0000 |
| commit | 8932ac050e4dee0f8d8f783006b2ad15810ba849 (patch) | |
| tree | 2b28138b88e3c9f97286d1d3e297852c11dfd430 | |
| parent | 073d93827f77e8787cdb7ec1ae28b60866334482 (diff) | |
| download | strace-8932ac050e4dee0f8d8f783006b2ad15810ba849.tar.gz | |
tests: add check for decoding of netfilter subsystem
* tests/netlink_netfilter.c(test_nfgenmsg): Add check for decoding
of netfilter subsystem.
| -rw-r--r-- | tests/netlink_netfilter.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/netlink_netfilter.c b/tests/netlink_netfilter.c index 2826017d1..57532f529 100644 --- a/tests/netlink_netfilter.c +++ b/tests/netlink_netfilter.c @@ -164,6 +164,27 @@ test_nfgenmsg(const int fd) printf(", res_id=htons(%d)" ", \"\\x31\\x32\\x33\\x34\"", 0xabcd)); # endif /* NFNL_MSG_BATCH_BEGIN */ + + static const struct nlattr nla = { + .nla_len = sizeof(nla), + .nla_type = 0x0bcd + }; + char nla_buf[NLMSG_ALIGN(sizeof(msg)) + sizeof(nla)]; + + msg.res_id = htons(NFNL_SUBSYS_NFTABLES); + memcpy(nla_buf, &msg, sizeof(msg)); + memcpy(nla_buf + NLMSG_ALIGN(sizeof(msg)), &nla, sizeof(nla)); + + TEST_NETLINK_(fd, nlh0, + NFNL_SUBSYS_NFTABLES << 8 | 0xff, + "NFNL_SUBSYS_NFTABLES<<8|0xff /* NFT_MSG_??? */", + NLM_F_REQUEST, "NLM_F_REQUEST", + sizeof(nla_buf), nla_buf, sizeof(nla_buf), + printf("{nfgen_family=AF_UNIX"); + printf(", version=NFNETLINK_V0"); + printf(", res_id=htons(NFNL_SUBSYS_NFTABLES)" + ", {nla_len=%d, nla_type=%#x}", + nla.nla_len, nla.nla_type)); } int main(void) |
