1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* PPTP constants and structs */
3 #ifndef _NF_CONNTRACK_PPTP_H
4 #define _NF_CONNTRACK_PPTP_H
6 #include <linux/netfilter/nf_conntrack_common.h>
8 extern const char *const pptp_msg_name
[];
10 /* state of the control session */
11 enum pptp_ctrlsess_state
{
12 PPTP_SESSION_NONE
, /* no session present */
13 PPTP_SESSION_ERROR
, /* some session error */
14 PPTP_SESSION_STOPREQ
, /* stop_sess request seen */
15 PPTP_SESSION_REQUESTED
, /* start_sess request seen */
16 PPTP_SESSION_CONFIRMED
, /* session established */
19 /* state of the call inside the control session */
20 enum pptp_ctrlcall_state
{
31 /* conntrack private data */
32 struct nf_ct_pptp_master
{
33 enum pptp_ctrlsess_state sstate
; /* session state */
34 enum pptp_ctrlcall_state cstate
; /* call state */
35 __be16 pac_call_id
; /* call id of PAC */
36 __be16 pns_call_id
; /* call id of PNS */
38 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
39 * and therefore imposes a fixed limit on the number of maps */
40 struct nf_ct_gre_keymap
*keymap
[IP_CT_DIR_MAX
];
44 __be16 pns_call_id
; /* NAT'ed PNS call id */
45 __be16 pac_call_id
; /* NAT'ed PAC call id */
50 #define PPTP_CONTROL_PORT 1723
52 #define PPTP_PACKET_CONTROL 1
53 #define PPTP_PACKET_MGMT 2
55 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d
63 /* PptpControlMessageType values */
64 #define PPTP_START_SESSION_REQUEST 1
65 #define PPTP_START_SESSION_REPLY 2
66 #define PPTP_STOP_SESSION_REQUEST 3
67 #define PPTP_STOP_SESSION_REPLY 4
68 #define PPTP_ECHO_REQUEST 5
69 #define PPTP_ECHO_REPLY 6
70 #define PPTP_OUT_CALL_REQUEST 7
71 #define PPTP_OUT_CALL_REPLY 8
72 #define PPTP_IN_CALL_REQUEST 9
73 #define PPTP_IN_CALL_REPLY 10
74 #define PPTP_IN_CALL_CONNECT 11
75 #define PPTP_CALL_CLEAR_REQUEST 12
76 #define PPTP_CALL_DISCONNECT_NOTIFY 13
77 #define PPTP_WAN_ERROR_NOTIFY 14
78 #define PPTP_SET_LINK_INFO 15
80 #define PPTP_MSG_MAX 15
82 /* PptpGeneralError values */
83 #define PPTP_ERROR_CODE_NONE 0
84 #define PPTP_NOT_CONNECTED 1
85 #define PPTP_BAD_FORMAT 2
86 #define PPTP_BAD_VALUE 3
87 #define PPTP_NO_RESOURCE 4
88 #define PPTP_BAD_CALLID 5
89 #define PPTP_REMOVE_DEVICE_ERROR 6
91 struct PptpControlHeader
{
96 /* FramingCapability Bitmap Values */
97 #define PPTP_FRAME_CAP_ASYNC 0x1
98 #define PPTP_FRAME_CAP_SYNC 0x2
100 /* BearerCapability Bitmap Values */
101 #define PPTP_BEARER_CAP_ANALOG 0x1
102 #define PPTP_BEARER_CAP_DIGITAL 0x2
104 struct PptpStartSessionRequest
{
105 __be16 protocolVersion
;
107 __be32 framingCapability
;
108 __be32 bearerCapability
;
110 __be16 firmwareRevision
;
112 __u8 vendorString
[64];
115 /* PptpStartSessionResultCode Values */
116 #define PPTP_START_OK 1
117 #define PPTP_START_GENERAL_ERROR 2
118 #define PPTP_START_ALREADY_CONNECTED 3
119 #define PPTP_START_NOT_AUTHORIZED 4
120 #define PPTP_START_UNKNOWN_PROTOCOL 5
122 struct PptpStartSessionReply
{
123 __be16 protocolVersion
;
125 __u8 generalErrorCode
;
126 __be32 framingCapability
;
127 __be32 bearerCapability
;
129 __be16 firmwareRevision
;
131 __u8 vendorString
[64];
134 /* PptpStopReasons */
135 #define PPTP_STOP_NONE 1
136 #define PPTP_STOP_PROTOCOL 2
137 #define PPTP_STOP_LOCAL_SHUTDOWN 3
139 struct PptpStopSessionRequest
{
145 /* PptpStopSessionResultCode */
146 #define PPTP_STOP_OK 1
147 #define PPTP_STOP_GENERAL_ERROR 2
149 struct PptpStopSessionReply
{
151 __u8 generalErrorCode
;
155 struct PptpEchoRequest
{
159 /* PptpEchoReplyResultCode */
160 #define PPTP_ECHO_OK 1
161 #define PPTP_ECHO_GENERAL_ERROR 2
163 struct PptpEchoReply
{
166 __u8 generalErrorCode
;
170 /* PptpFramingType */
171 #define PPTP_ASYNC_FRAMING 1
172 #define PPTP_SYNC_FRAMING 2
173 #define PPTP_DONT_CARE_FRAMING 3
175 /* PptpCallBearerType */
176 #define PPTP_ANALOG_TYPE 1
177 #define PPTP_DIGITAL_TYPE 2
178 #define PPTP_DONT_CARE_BEARER_TYPE 3
180 struct PptpOutCallRequest
{
182 __be16 callSerialNumber
;
188 __be16 packetProcDelay
;
189 __be16 phoneNumberLength
;
191 __u8 phoneNumber
[64];
195 /* PptpCallResultCode */
196 #define PPTP_OUTCALL_CONNECT 1
197 #define PPTP_OUTCALL_GENERAL_ERROR 2
198 #define PPTP_OUTCALL_NO_CARRIER 3
199 #define PPTP_OUTCALL_BUSY 4
200 #define PPTP_OUTCALL_NO_DIAL_TONE 5
201 #define PPTP_OUTCALL_TIMEOUT 6
202 #define PPTP_OUTCALL_DONT_ACCEPT 7
204 struct PptpOutCallReply
{
208 __u8 generalErrorCode
;
212 __be16 packetProcDelay
;
213 __be32 physChannelID
;
216 struct PptpInCallRequest
{
218 __be16 callSerialNumber
;
219 __be32 callBearerType
;
220 __be32 physChannelID
;
221 __be16 dialedNumberLength
;
222 __be16 dialingNumberLength
;
223 __u8 dialedNumber
[64];
224 __u8 dialingNumber
[64];
228 /* PptpInCallResultCode */
229 #define PPTP_INCALL_ACCEPT 1
230 #define PPTP_INCALL_GENERAL_ERROR 2
231 #define PPTP_INCALL_DONT_ACCEPT 3
233 struct PptpInCallReply
{
237 __u8 generalErrorCode
;
239 __be16 packetProcDelay
;
243 struct PptpInCallConnected
{
248 __be16 packetProcDelay
;
249 __be32 callFramingType
;
252 struct PptpClearCallRequest
{
257 struct PptpCallDisconnectNotify
{
260 __u8 generalErrorCode
;
263 __u8 callStatistics
[128];
266 struct PptpWanErrorNotify
{
270 __be32 framingErrors
;
271 __be32 hardwareOverRuns
;
272 __be32 bufferOverRuns
;
273 __be32 timeoutErrors
;
274 __be32 alignmentErrors
;
277 struct PptpSetLinkInfo
{
284 union pptp_ctrl_union
{
285 struct PptpStartSessionRequest sreq
;
286 struct PptpStartSessionReply srep
;
287 struct PptpStopSessionRequest streq
;
288 struct PptpStopSessionReply strep
;
289 struct PptpOutCallRequest ocreq
;
290 struct PptpOutCallReply ocack
;
291 struct PptpInCallRequest icreq
;
292 struct PptpInCallReply icack
;
293 struct PptpInCallConnected iccon
;
294 struct PptpClearCallRequest clrreq
;
295 struct PptpCallDisconnectNotify disc
;
296 struct PptpWanErrorNotify wanerr
;
297 struct PptpSetLinkInfo setlink
;
300 /* crap needed for nf_conntrack_compat.h */
302 struct nf_conntrack_expect
;
305 (*nf_nat_pptp_hook_outbound
)(struct sk_buff
*skb
,
306 struct nf_conn
*ct
, enum ip_conntrack_info ctinfo
,
307 unsigned int protoff
,
308 struct PptpControlHeader
*ctlh
,
309 union pptp_ctrl_union
*pptpReq
);
312 (*nf_nat_pptp_hook_inbound
)(struct sk_buff
*skb
,
313 struct nf_conn
*ct
, enum ip_conntrack_info ctinfo
,
314 unsigned int protoff
,
315 struct PptpControlHeader
*ctlh
,
316 union pptp_ctrl_union
*pptpReq
);
319 (*nf_nat_pptp_hook_exp_gre
)(struct nf_conntrack_expect
*exp_orig
,
320 struct nf_conntrack_expect
*exp_reply
);
323 (*nf_nat_pptp_hook_expectfn
)(struct nf_conn
*ct
,
324 struct nf_conntrack_expect
*exp
);
326 #endif /* __KERNEL__ */
327 #endif /* _NF_CONNTRACK_PPTP_H */