1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /* IPv4-specific defines for netfilter.
3  * (C)1998 Rusty Russell -- This code is GPL.
4  */
5 #ifndef _UAPI__LINUX_IP_NETFILTER_H
6 #define _UAPI__LINUX_IP_NETFILTER_H
7 
8 
9 #include <linux/netfilter.h>
10 
11 /* only for userspace compatibility */
12 #ifndef __KERNEL__
13 
14 #include <limits.h> /* for INT_MIN, INT_MAX */
15 
16 /* IP Cache bits. */
17 /* Src IP address. */
18 #define NFC_IP_SRC		0x0001
19 /* Dest IP address. */
20 #define NFC_IP_DST		0x0002
21 /* Input device. */
22 #define NFC_IP_IF_IN		0x0004
23 /* Output device. */
24 #define NFC_IP_IF_OUT		0x0008
25 /* TOS. */
26 #define NFC_IP_TOS		0x0010
27 /* Protocol. */
28 #define NFC_IP_PROTO		0x0020
29 /* IP options. */
30 #define NFC_IP_OPTIONS		0x0040
31 /* Frag & flags. */
32 #define NFC_IP_FRAG		0x0080
33 
34 /* Per-protocol information: only matters if proto match. */
35 /* TCP flags. */
36 #define NFC_IP_TCPFLAGS		0x0100
37 /* Source port. */
38 #define NFC_IP_SRC_PT		0x0200
39 /* Dest port. */
40 #define NFC_IP_DST_PT		0x0400
41 /* Something else about the proto */
42 #define NFC_IP_PROTO_UNKNOWN	0x2000
43 
44 /* IP Hooks */
45 /* After promisc drops, checksum checks. */
46 #define NF_IP_PRE_ROUTING	0
47 /* If the packet is destined for this box. */
48 #define NF_IP_LOCAL_IN		1
49 /* If the packet is destined for another interface. */
50 #define NF_IP_FORWARD		2
51 /* Packets coming from a local process. */
52 #define NF_IP_LOCAL_OUT		3
53 /* Packets about to hit the wire. */
54 #define NF_IP_POST_ROUTING	4
55 #define NF_IP_NUMHOOKS		5
56 #endif /* ! __KERNEL__ */
57 
58 enum nf_ip_hook_priorities {
59 	NF_IP_PRI_FIRST = INT_MIN,
60 	NF_IP_PRI_RAW_BEFORE_DEFRAG = -450,
61 	NF_IP_PRI_CONNTRACK_DEFRAG = -400,
62 	NF_IP_PRI_RAW = -300,
63 	NF_IP_PRI_SELINUX_FIRST = -225,
64 	NF_IP_PRI_CONNTRACK = -200,
65 	NF_IP_PRI_MANGLE = -150,
66 	NF_IP_PRI_NAT_DST = -100,
67 	NF_IP_PRI_FILTER = 0,
68 	NF_IP_PRI_SECURITY = 50,
69 	NF_IP_PRI_NAT_SRC = 100,
70 	NF_IP_PRI_SELINUX_LAST = 225,
71 	NF_IP_PRI_CONNTRACK_HELPER = 300,
72 	NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
73 	NF_IP_PRI_LAST = INT_MAX,
74 };
75 
76 /* Arguments for setsockopt SOL_IP: */
77 /* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */
78 /* 2.2 firewalling (+ masq) went from 64 through 76 */
79 /* 2.4 firewalling went 64 through 67. */
80 #define SO_ORIGINAL_DST 80
81 
82 
83 #endif /* _UAPI__LINUX_IP_NETFILTER_H */
84