1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_NFNETLINK_H
3 #define _UAPI_NFNETLINK_H
4 #include <linux/types.h>
5 #include <linux/netfilter/nfnetlink_compat.h>
6 
7 enum nfnetlink_groups {
8 	NFNLGRP_NONE,
9 #define NFNLGRP_NONE			NFNLGRP_NONE
10 	NFNLGRP_CONNTRACK_NEW,
11 #define NFNLGRP_CONNTRACK_NEW		NFNLGRP_CONNTRACK_NEW
12 	NFNLGRP_CONNTRACK_UPDATE,
13 #define NFNLGRP_CONNTRACK_UPDATE	NFNLGRP_CONNTRACK_UPDATE
14 	NFNLGRP_CONNTRACK_DESTROY,
15 #define NFNLGRP_CONNTRACK_DESTROY	NFNLGRP_CONNTRACK_DESTROY
16 	NFNLGRP_CONNTRACK_EXP_NEW,
17 #define	NFNLGRP_CONNTRACK_EXP_NEW	NFNLGRP_CONNTRACK_EXP_NEW
18 	NFNLGRP_CONNTRACK_EXP_UPDATE,
19 #define NFNLGRP_CONNTRACK_EXP_UPDATE	NFNLGRP_CONNTRACK_EXP_UPDATE
20 	NFNLGRP_CONNTRACK_EXP_DESTROY,
21 #define NFNLGRP_CONNTRACK_EXP_DESTROY	NFNLGRP_CONNTRACK_EXP_DESTROY
22 	NFNLGRP_NFTABLES,
23 #define NFNLGRP_NFTABLES                NFNLGRP_NFTABLES
24 	NFNLGRP_ACCT_QUOTA,
25 #define NFNLGRP_ACCT_QUOTA		NFNLGRP_ACCT_QUOTA
26 	NFNLGRP_NFTRACE,
27 #define NFNLGRP_NFTRACE			NFNLGRP_NFTRACE
28 	__NFNLGRP_MAX,
29 };
30 #define NFNLGRP_MAX	(__NFNLGRP_MAX - 1)
31 
32 /* General form of address family dependent message.
33  */
34 struct nfgenmsg {
35 	__u8  nfgen_family;		/* AF_xxx */
36 	__u8  version;		/* nfnetlink version */
37 	__be16    res_id;		/* resource id */
38 };
39 
40 #define NFNETLINK_V0	0
41 
42 /* netfilter netlink message types are split in two pieces:
43  * 8 bit subsystem, 8bit operation.
44  */
45 
46 #define NFNL_SUBSYS_ID(x)	((x & 0xff00) >> 8)
47 #define NFNL_MSG_TYPE(x)	(x & 0x00ff)
48 
49 /* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS()
50  * won't work anymore */
51 #define NFNL_SUBSYS_NONE 		0
52 #define NFNL_SUBSYS_CTNETLINK		1
53 #define NFNL_SUBSYS_CTNETLINK_EXP	2
54 #define NFNL_SUBSYS_QUEUE		3
55 #define NFNL_SUBSYS_ULOG		4
56 #define NFNL_SUBSYS_OSF			5
57 #define NFNL_SUBSYS_IPSET		6
58 #define NFNL_SUBSYS_ACCT		7
59 #define NFNL_SUBSYS_CTNETLINK_TIMEOUT	8
60 #define NFNL_SUBSYS_CTHELPER		9
61 #define NFNL_SUBSYS_NFTABLES		10
62 #define NFNL_SUBSYS_NFT_COMPAT		11
63 #define NFNL_SUBSYS_HOOK		12
64 #define NFNL_SUBSYS_COUNT		13
65 
66 /* Reserved control nfnetlink messages */
67 #define NFNL_MSG_BATCH_BEGIN		NLMSG_MIN_TYPE
68 #define NFNL_MSG_BATCH_END		NLMSG_MIN_TYPE+1
69 
70 /**
71  * enum nfnl_batch_attributes - nfnetlink batch netlink attributes
72  *
73  * @NFNL_BATCH_GENID: generation ID for this changeset (NLA_U32)
74  */
75 enum nfnl_batch_attributes {
76         NFNL_BATCH_UNSPEC,
77         NFNL_BATCH_GENID,
78         __NFNL_BATCH_MAX
79 };
80 #define NFNL_BATCH_MAX			(__NFNL_BATCH_MAX - 1)
81 
82 #endif /* _UAPI_NFNETLINK_H */
83