2 * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com>
3 * Copyright (c) 2017-2018 The strace developers.
6 * SPDX-License-Identifier: GPL-2.0-or-later
11 #ifdef HAVE_LINUX_NETFILTER_XT_OSF_H
14 # include <sys/socket.h>
16 # include <linux/ip.h>
17 # include <linux/tcp.h>
18 # include <linux/netfilter/nfnetlink.h>
19 # include <linux/netfilter/xt_osf.h>
22 test_nlmsg_type(const int fd)
25 struct nlmsghdr nlh = {
26 .nlmsg_len = sizeof(nlh),
27 .nlmsg_flags = NLM_F_REQUEST,
30 nlh.nlmsg_type = NFNL_SUBSYS_OSF << 8 | OSF_MSG_ADD;
31 rc = sendto(fd, &nlh, nlh.nlmsg_len, MSG_DONTWAIT, NULL, 0);
32 printf("sendto(%d, {len=%u"
33 ", type=NFNL_SUBSYS_OSF<<8|OSF_MSG_ADD"
34 ", flags=NLM_F_REQUEST, seq=0, pid=0}"
35 ", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
36 fd, nlh.nlmsg_len, nlh.nlmsg_len, sprintrc(rc));
38 nlh.nlmsg_type = NFNL_SUBSYS_OSF << 8 | 0xff;
39 rc = sendto(fd, &nlh, nlh.nlmsg_len, MSG_DONTWAIT, NULL, 0);
40 printf("sendto(%d, {len=%u"
41 ", type=NFNL_SUBSYS_OSF<<8|0xff /* OSF_MSG_??? */"
42 ", flags=NLM_F_REQUEST, seq=0, pid=0}"
43 ", %u, MSG_DONTWAIT, NULL, 0) = %s\n",
44 fd, nlh.nlmsg_len, nlh.nlmsg_len, sprintrc(rc));
50 skip_if_unavailable("/proc/self/fd/");
52 int fd = create_nl_socket(NETLINK_NETFILTER);
56 puts("+++ exited with 0 +++");
63 SKIP_MAIN_UNDEFINED("HAVE_LINUX_NETFILTER_XT_OSF_H")