]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/uapi/linux/netfilter/xt_osf.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
[mirror_ubuntu-bionic-kernel.git] / include / uapi / linux / netfilter / xt_osf.h
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3 * Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef _XT_OSF_H
21 #define _XT_OSF_H
22
23 #include <linux/types.h>
24 #include <linux/ip.h>
25 #include <linux/tcp.h>
26
27 #define MAXGENRELEN 32
28
29 #define XT_OSF_GENRE (1<<0)
30 #define XT_OSF_TTL (1<<1)
31 #define XT_OSF_LOG (1<<2)
32 #define XT_OSF_INVERT (1<<3)
33
34 #define XT_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */
35 #define XT_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */
36 #define XT_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */
37
38 #define XT_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */
39 #define XT_OSF_TTL_LESS 1 /* Check if ip TTL is less than fingerprint one */
40 #define XT_OSF_TTL_NOCHECK 2 /* Do not compare ip and fingerprint TTL at all */
41
42 struct xt_osf_info {
43 char genre[MAXGENRELEN];
44 __u32 len;
45 __u32 flags;
46 __u32 loglevel;
47 __u32 ttl;
48 };
49
50 /*
51 * Wildcard MSS (kind of).
52 * It is used to implement a state machine for the different wildcard values
53 * of the MSS and window sizes.
54 */
55 struct xt_osf_wc {
56 __u32 wc;
57 __u32 val;
58 };
59
60 /*
61 * This struct represents IANA options
62 * http://www.iana.org/assignments/tcp-parameters
63 */
64 struct xt_osf_opt {
65 __u16 kind, length;
66 struct xt_osf_wc wc;
67 };
68
69 struct xt_osf_user_finger {
70 struct xt_osf_wc wss;
71
72 __u8 ttl, df;
73 __u16 ss, mss;
74 __u16 opt_num;
75
76 char genre[MAXGENRELEN];
77 char version[MAXGENRELEN];
78 char subtype[MAXGENRELEN];
79
80 /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */
81 struct xt_osf_opt opt[MAX_IPOPTLEN];
82 };
83
84 struct xt_osf_nlmsg {
85 struct xt_osf_user_finger f;
86 struct iphdr ip;
87 struct tcphdr tcp;
88 };
89
90 /* Defines for IANA option kinds */
91
92 enum iana_options {
93 OSFOPT_EOL = 0, /* End of options */
94 OSFOPT_NOP, /* NOP */
95 OSFOPT_MSS, /* Maximum segment size */
96 OSFOPT_WSO, /* Window scale option */
97 OSFOPT_SACKP, /* SACK permitted */
98 OSFOPT_SACK, /* SACK */
99 OSFOPT_ECHO,
100 OSFOPT_ECHOREPLY,
101 OSFOPT_TS, /* Timestamp option */
102 OSFOPT_POCP, /* Partial Order Connection Permitted */
103 OSFOPT_POSP, /* Partial Order Service Profile */
104
105 /* Others are not used in the current OSF */
106 OSFOPT_EMPTY = 255,
107 };
108
109 /*
110 * Initial window size option state machine: multiple of mss, mtu or
111 * plain numeric value. Can also be made as plain numeric value which
112 * is not a multiple of specified value.
113 */
114 enum xt_osf_window_size_options {
115 OSF_WSS_PLAIN = 0,
116 OSF_WSS_MSS,
117 OSF_WSS_MTU,
118 OSF_WSS_MODULO,
119 OSF_WSS_MAX,
120 };
121
122 /*
123 * Add/remove fingerprint from the kernel.
124 */
125 enum xt_osf_msg_types {
126 OSF_MSG_ADD,
127 OSF_MSG_REMOVE,
128 OSF_MSG_MAX,
129 };
130
131 enum xt_osf_attr_type {
132 OSF_ATTR_UNSPEC,
133 OSF_ATTR_FINGER,
134 OSF_ATTR_MAX,
135 };
136
137 #endif /* _XT_OSF_H */