1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _NFNETLINK_LOG_H
3 #define _NFNETLINK_LOG_H
4 
5 /* This file describes the netlink messages (i.e. 'protocol packets'),
6  * and not any kind of function definitions.  It is shared between kernel and
7  * userspace.  Don't put kernel specific stuff in here */
8 
9 #include <linux/types.h>
10 #include <linux/netfilter/nfnetlink.h>
11 
12 enum nfulnl_msg_types {
13 	NFULNL_MSG_PACKET,		/* packet from kernel to userspace */
14 	NFULNL_MSG_CONFIG,		/* connect to a particular queue */
15 
16 	NFULNL_MSG_MAX
17 };
18 
19 struct nfulnl_msg_packet_hdr {
20 	__be16		hw_protocol;	/* hw protocol (network order) */
21 	__u8	hook;		/* netfilter hook */
22 	__u8	_pad;
23 };
24 
25 struct nfulnl_msg_packet_hw {
26 	__be16		hw_addrlen;
27 	__u16	_pad;
28 	__u8	hw_addr[8];
29 };
30 
31 struct nfulnl_msg_packet_timestamp {
32 	__aligned_be64	sec;
33 	__aligned_be64	usec;
34 };
35 
36 enum nfulnl_vlan_attr {
37 	NFULA_VLAN_UNSPEC,
38 	NFULA_VLAN_PROTO,		/* __be16 skb vlan_proto */
39 	NFULA_VLAN_TCI,			/* __be16 skb htons(vlan_tci) */
40 	__NFULA_VLAN_MAX,
41 };
42 
43 #define NFULA_VLAN_MAX (__NFULA_VLAN_MAX + 1)
44 
45 enum nfulnl_attr_type {
46 	NFULA_UNSPEC,
47 	NFULA_PACKET_HDR,
48 	NFULA_MARK,			/* __u32 nfmark */
49 	NFULA_TIMESTAMP,		/* nfulnl_msg_packet_timestamp */
50 	NFULA_IFINDEX_INDEV,		/* __u32 ifindex */
51 	NFULA_IFINDEX_OUTDEV,		/* __u32 ifindex */
52 	NFULA_IFINDEX_PHYSINDEV,	/* __u32 ifindex */
53 	NFULA_IFINDEX_PHYSOUTDEV,	/* __u32 ifindex */
54 	NFULA_HWADDR,			/* nfulnl_msg_packet_hw */
55 	NFULA_PAYLOAD,			/* opaque data payload */
56 	NFULA_PREFIX,			/* string prefix */
57 	NFULA_UID,			/* user id of socket */
58 	NFULA_SEQ,			/* instance-local sequence number */
59 	NFULA_SEQ_GLOBAL,		/* global sequence number */
60 	NFULA_GID,			/* group id of socket */
61 	NFULA_HWTYPE,			/* hardware type */
62 	NFULA_HWHEADER,			/* hardware header */
63 	NFULA_HWLEN,			/* hardware header length */
64 	NFULA_CT,                       /* nfnetlink_conntrack.h */
65 	NFULA_CT_INFO,                  /* enum ip_conntrack_info */
66 	NFULA_VLAN,			/* nested attribute: packet vlan info */
67 	NFULA_L2HDR,			/* full L2 header */
68 
69 	__NFULA_MAX
70 };
71 #define NFULA_MAX (__NFULA_MAX - 1)
72 
73 enum nfulnl_msg_config_cmds {
74 	NFULNL_CFG_CMD_NONE,
75 	NFULNL_CFG_CMD_BIND,
76 	NFULNL_CFG_CMD_UNBIND,
77 	NFULNL_CFG_CMD_PF_BIND,
78 	NFULNL_CFG_CMD_PF_UNBIND,
79 };
80 
81 struct nfulnl_msg_config_cmd {
82 	__u8	command;	/* nfulnl_msg_config_cmds */
83 } __attribute__ ((packed));
84 
85 struct nfulnl_msg_config_mode {
86 	__be32		copy_range;
87 	__u8	copy_mode;
88 	__u8	_pad;
89 } __attribute__ ((packed));
90 
91 enum nfulnl_attr_config {
92 	NFULA_CFG_UNSPEC,
93 	NFULA_CFG_CMD,			/* nfulnl_msg_config_cmd */
94 	NFULA_CFG_MODE,			/* nfulnl_msg_config_mode */
95 	NFULA_CFG_NLBUFSIZ,		/* __u32 buffer size */
96 	NFULA_CFG_TIMEOUT,		/* __u32 in 1/100 s */
97 	NFULA_CFG_QTHRESH,		/* __u32 */
98 	NFULA_CFG_FLAGS,		/* __u16 */
99 	__NFULA_CFG_MAX
100 };
101 #define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
102 
103 #define NFULNL_COPY_NONE	0x00
104 #define NFULNL_COPY_META	0x01
105 #define NFULNL_COPY_PACKET	0x02
106 /* 0xff is reserved, don't use it for new copy modes. */
107 
108 #define NFULNL_CFG_F_SEQ	0x0001
109 #define NFULNL_CFG_F_SEQ_GLOBAL	0x0002
110 #define NFULNL_CFG_F_CONNTRACK	0x0004
111 
112 #endif /* _NFNETLINK_LOG_H */
113