2 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 * PPTP support contributed by Motonori Shindo (mshindo@mshindo.net)
24 /* \summary: Point-to-Point Tunnelling Protocol (PPTP) printer */
26 /* specification: RFC 2637 */
30 #include "netdissect-stdinc.h"
32 #include "netdissect.h"
36 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
37 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
38 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
40 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
41 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
42 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
43 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
44 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
45 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
46 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
47 #define PPTP_CTRL_MSG_TYPE_OCRP 8
48 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
49 #define PPTP_CTRL_MSG_TYPE_ICRP 10
50 #define PPTP_CTRL_MSG_TYPE_ICCN 11
51 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
52 #define PPTP_CTRL_MSG_TYPE_CDN 13
53 #define PPTP_CTRL_MSG_TYPE_WEN 14
54 #define PPTP_CTRL_MSG_TYPE_SLI 15
56 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Asynchronous */
57 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
59 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
60 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
62 static const char *pptp_message_type_string
[] = {
63 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
64 "SCCRQ", /* 1 Start-Control-Connection-Request */
65 "SCCRP", /* 2 Start-Control-Connection-Reply */
66 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
67 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
68 "ECHORQ", /* 5 Echo Request */
69 "ECHORP", /* 6 Echo Reply */
71 "OCRQ", /* 7 Outgoing-Call-Request */
72 "OCRP", /* 8 Outgoing-Call-Reply */
73 "ICRQ", /* 9 Incoming-Call-Request */
74 "ICRP", /* 10 Incoming-Call-Reply */
75 "ICCN", /* 11 Incoming-Call-Connected */
76 "CCRQ", /* 12 Call-Clear-Request */
77 "CDN", /* 13 Call-Disconnect-Notify */
79 "WEN", /* 14 WAN-Error-Notify */
81 "SLI" /* 15 Set-Link-Info */
82 #define PPTP_MAX_MSGTYPE_INDEX 16
85 /* common for all PPTP control messages */
89 nd_uint32_t magic_cookie
;
90 nd_uint16_t ctrl_msg_type
;
91 nd_uint16_t reserved0
;
94 struct pptp_msg_sccrq
{
95 nd_uint16_t proto_ver
;
96 nd_uint16_t reserved1
;
97 nd_uint32_t framing_cap
;
98 nd_uint32_t bearer_cap
;
99 nd_uint16_t max_channel
;
100 nd_uint16_t firm_rev
;
101 nd_byte hostname
[64];
105 struct pptp_msg_sccrp
{
106 nd_uint16_t proto_ver
;
107 nd_uint8_t result_code
;
109 nd_uint32_t framing_cap
;
110 nd_uint32_t bearer_cap
;
111 nd_uint16_t max_channel
;
112 nd_uint16_t firm_rev
;
113 nd_byte hostname
[64];
117 struct pptp_msg_stopccrq
{
119 nd_uint8_t reserved1
;
120 nd_uint16_t reserved2
;
123 struct pptp_msg_stopccrp
{
124 nd_uint8_t result_code
;
126 nd_uint16_t reserved1
;
129 struct pptp_msg_echorq
{
133 struct pptp_msg_echorp
{
135 nd_uint8_t result_code
;
137 nd_uint16_t reserved1
;
140 struct pptp_msg_ocrq
{
142 nd_uint16_t call_ser
;
145 nd_uint32_t bearer_type
;
146 nd_uint32_t framing_type
;
147 nd_uint16_t recv_winsiz
;
148 nd_uint16_t pkt_proc_delay
;
149 nd_uint16_t phone_no_len
;
150 nd_uint16_t reserved1
;
151 nd_byte phone_no
[64];
155 struct pptp_msg_ocrp
{
157 nd_uint16_t peer_call_id
;
158 nd_uint8_t result_code
;
160 nd_uint16_t cause_code
;
161 nd_uint32_t conn_speed
;
162 nd_uint16_t recv_winsiz
;
163 nd_uint16_t pkt_proc_delay
;
164 nd_uint32_t phy_chan_id
;
167 struct pptp_msg_icrq
{
169 nd_uint16_t call_ser
;
170 nd_uint32_t bearer_type
;
171 nd_uint32_t phy_chan_id
;
172 nd_uint16_t dialed_no_len
;
173 nd_uint16_t dialing_no_len
;
174 nd_byte dialed_no
[64]; /* DNIS */
175 nd_byte dialing_no
[64]; /* CLID */
179 struct pptp_msg_icrp
{
181 nd_uint16_t peer_call_id
;
182 nd_uint8_t result_code
;
184 nd_uint16_t recv_winsiz
;
185 nd_uint16_t pkt_proc_delay
;
186 nd_uint16_t reserved1
;
189 struct pptp_msg_iccn
{
190 nd_uint16_t peer_call_id
;
191 nd_uint16_t reserved1
;
192 nd_uint32_t conn_speed
;
193 nd_uint16_t recv_winsiz
;
194 nd_uint16_t pkt_proc_delay
;
195 nd_uint32_t framing_type
;
198 struct pptp_msg_ccrq
{
200 nd_uint16_t reserved1
;
203 struct pptp_msg_cdn
{
205 nd_uint8_t result_code
;
207 nd_uint16_t cause_code
;
208 nd_uint16_t reserved1
;
209 nd_byte call_stats
[128];
212 struct pptp_msg_wen
{
213 nd_uint16_t peer_call_id
;
214 nd_uint16_t reserved1
;
216 nd_uint32_t framing_err
;
217 nd_uint32_t hardware_overrun
;
218 nd_uint32_t buffer_overrun
;
219 nd_uint32_t timeout_err
;
220 nd_uint32_t align_err
;
223 struct pptp_msg_sli
{
224 nd_uint16_t peer_call_id
;
225 nd_uint16_t reserved1
;
226 nd_uint32_t send_accm
;
227 nd_uint32_t recv_accm
;
230 /* attributes that appear more than once in above messages:
233 occurrence attributes
234 --------------------------------------
235 2 uint32_t bearer_cap;
236 2 uint32_t bearer_type;
239 2 uint16_t cause_code;
240 2 uint32_t conn_speed;
243 2 uint32_t framing_cap;
244 2 uint32_t framing_type;
245 2 u_char hostname[64];
247 2 uint16_t max_channel;
248 5 uint16_t peer_call_id;
249 2 uint32_t phy_chan_id;
250 4 uint16_t pkt_proc_delay;
251 2 uint16_t proto_ver;
252 4 uint16_t recv_winsiz;
254 9 uint16_t reserved1;
255 6 uint8_t result_code;
256 2 u_char subaddr[64];
259 so I will prepare print out functions for these attributes (except for
263 #define PRINT_RESERVED_IF_NOT_ZERO_1(reserved) \
264 if (GET_U_1(reserved)) \
265 ND_PRINT(" [ERROR: reserved=%u must be zero]", \
268 #define PRINT_RESERVED_IF_NOT_ZERO_2(reserved) \
269 if (GET_BE_U_2(reserved)) \
270 ND_PRINT(" [ERROR: reserved=%u must be zero]", \
271 GET_BE_U_2(reserved));
273 /******************************************/
274 /* Attribute-specific print out functions */
275 /******************************************/
278 pptp_bearer_cap_print(netdissect_options
*ndo
,
279 const nd_uint32_t bearer_cap
)
281 ND_PRINT(" BEARER_CAP(%s%s)",
282 GET_BE_U_4(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
? "D" : "",
283 GET_BE_U_4(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
? "A" : "");
286 static const struct tok pptp_btype_str
[] = {
287 { 1, "A" }, /* Analog */
288 { 2, "D" }, /* Digital */
294 pptp_bearer_type_print(netdissect_options
*ndo
,
295 const nd_uint32_t bearer_type
)
297 ND_PRINT(" BEARER_TYPE(%s)",
298 tok2str(pptp_btype_str
, "?", GET_BE_U_4(bearer_type
)));
302 pptp_call_id_print(netdissect_options
*ndo
,
303 const nd_uint16_t call_id
)
305 ND_PRINT(" CALL_ID(%u)", GET_BE_U_2(call_id
));
309 pptp_call_ser_print(netdissect_options
*ndo
,
310 const nd_uint16_t call_ser
)
312 ND_PRINT(" CALL_SER_NUM(%u)", GET_BE_U_2(call_ser
));
316 pptp_cause_code_print(netdissect_options
*ndo
,
317 const nd_uint16_t cause_code
)
319 ND_PRINT(" CAUSE_CODE(%u)", GET_BE_U_2(cause_code
));
323 pptp_conn_speed_print(netdissect_options
*ndo
,
324 const nd_uint32_t conn_speed
)
326 ND_PRINT(" CONN_SPEED(%u)", GET_BE_U_4(conn_speed
));
329 static const struct tok pptp_errcode_str
[] = {
331 { 1, "Not-Connected" },
334 { 4, "No-Resource" },
335 { 5, "Bad-Call-ID" },
341 pptp_err_code_print(netdissect_options
*ndo
,
342 const nd_uint8_t err_code
)
344 ND_PRINT(" ERR_CODE(%u", GET_U_1(err_code
));
345 if (ndo
->ndo_vflag
) {
347 tok2str(pptp_errcode_str
, "?", GET_U_1(err_code
)));
353 pptp_firm_rev_print(netdissect_options
*ndo
,
354 const nd_uint16_t firm_rev
)
356 ND_PRINT(" FIRM_REV(%u)", GET_BE_U_2(firm_rev
));
360 pptp_framing_cap_print(netdissect_options
*ndo
,
361 const nd_uint32_t framing_cap
)
363 ND_PRINT(" FRAME_CAP(");
364 if (GET_BE_U_4(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
365 ND_PRINT("A"); /* Async */
367 if (GET_BE_U_4(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
368 ND_PRINT("S"); /* Sync */
373 static const struct tok pptp_ftype_str
[] = {
374 { 1, "A" }, /* Async */
375 { 2, "S" }, /* Sync */
376 { 3, "E" }, /* Either */
381 pptp_framing_type_print(netdissect_options
*ndo
,
382 const nd_uint32_t framing_type
)
384 ND_PRINT(" FRAME_TYPE(%s)",
385 tok2str(pptp_ftype_str
, "?", GET_BE_U_4(framing_type
)));
389 pptp_hostname_print(netdissect_options
*ndo
,
390 const u_char
*hostname
)
392 ND_PRINT(" HOSTNAME(");
393 nd_printjnp(ndo
, hostname
, 64);
398 pptp_id_print(netdissect_options
*ndo
,
399 const nd_uint32_t id
)
401 ND_PRINT(" ID(%u)", GET_BE_U_4(id
));
405 pptp_max_channel_print(netdissect_options
*ndo
,
406 const nd_uint16_t max_channel
)
408 ND_PRINT(" MAX_CHAN(%u)", GET_BE_U_2(max_channel
));
412 pptp_peer_call_id_print(netdissect_options
*ndo
,
413 const nd_uint16_t peer_call_id
)
415 ND_PRINT(" PEER_CALL_ID(%u)", GET_BE_U_2(peer_call_id
));
419 pptp_phy_chan_id_print(netdissect_options
*ndo
,
420 const nd_uint32_t phy_chan_id
)
422 ND_PRINT(" PHY_CHAN_ID(%u)", GET_BE_U_4(phy_chan_id
));
426 pptp_pkt_proc_delay_print(netdissect_options
*ndo
,
427 const nd_uint16_t pkt_proc_delay
)
429 ND_PRINT(" PROC_DELAY(%u)", GET_BE_U_2(pkt_proc_delay
));
433 pptp_proto_ver_print(netdissect_options
*ndo
,
434 const nd_uint16_t proto_ver
)
436 ND_PRINT(" PROTO_VER(%u.%u)", /* Version.Revision */
437 GET_BE_U_2(proto_ver
) >> 8,
438 GET_BE_U_2(proto_ver
) & 0xff);
442 pptp_recv_winsiz_print(netdissect_options
*ndo
,
443 const nd_uint16_t recv_winsiz
)
445 ND_PRINT(" RECV_WIN(%u)", GET_BE_U_2(recv_winsiz
));
448 static const struct tok pptp_scrrp_str
[] = {
449 { 1, "Successful channel establishment" },
450 { 2, "General error" },
451 { 3, "Command channel already exists" },
452 { 4, "Requester is not authorized to establish a command channel" },
453 { 5, "The protocol version of the requester is not supported" },
457 static const struct tok pptp_echorp_str
[] = {
459 { 2, "General Error" },
463 static const struct tok pptp_ocrp_str
[] = {
465 { 2, "General Error" },
468 { 5, "No Dial Tone" },
470 { 7, "Do Not Accept" },
474 static const struct tok pptp_icrp_str
[] = {
476 { 2, "General Error" },
477 { 3, "Do Not Accept" },
481 static const struct tok pptp_cdn_str
[] = {
482 { 1, "Lost Carrier" },
483 { 2, "General Error" },
484 { 3, "Admin Shutdown" },
490 pptp_result_code_print(netdissect_options
*ndo
,
491 const nd_uint8_t result_code
, int ctrl_msg_type
)
493 ND_PRINT(" RESULT_CODE(%u", GET_U_1(result_code
));
494 if (ndo
->ndo_vflag
) {
495 const struct tok
*dict
=
496 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_SCCRP
? pptp_scrrp_str
:
497 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_StopCCRP
? pptp_echorp_str
:
498 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ECHORP
? pptp_echorp_str
:
499 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_OCRP
? pptp_ocrp_str
:
500 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ICRP
? pptp_icrp_str
:
501 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_CDN
? pptp_cdn_str
:
502 NULL
; /* assertion error */
505 tok2str(dict
, "?", GET_U_1(result_code
)));
511 pptp_subaddr_print(netdissect_options
*ndo
,
512 const u_char
*subaddr
)
514 ND_PRINT(" SUB_ADDR(");
515 nd_printjnp(ndo
, subaddr
, 64);
520 pptp_vendor_print(netdissect_options
*ndo
,
521 const u_char
*vendor
)
523 ND_PRINT(" VENDOR(");
524 nd_printjnp(ndo
, vendor
, 64);
528 /************************************/
529 /* PPTP message print out functions */
530 /************************************/
532 pptp_sccrq_print(netdissect_options
*ndo
,
535 const struct pptp_msg_sccrq
*ptr
= (const struct pptp_msg_sccrq
*)dat
;
537 pptp_proto_ver_print(ndo
, ptr
->proto_ver
);
538 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
539 pptp_framing_cap_print(ndo
, ptr
->framing_cap
);
540 pptp_bearer_cap_print(ndo
, ptr
->bearer_cap
);
541 pptp_max_channel_print(ndo
, ptr
->max_channel
);
542 pptp_firm_rev_print(ndo
, ptr
->firm_rev
);
543 pptp_hostname_print(ndo
, ptr
->hostname
);
544 pptp_vendor_print(ndo
, ptr
->vendor
);
548 pptp_sccrp_print(netdissect_options
*ndo
,
551 const struct pptp_msg_sccrp
*ptr
= (const struct pptp_msg_sccrp
*)dat
;
553 pptp_proto_ver_print(ndo
, ptr
->proto_ver
);
554 pptp_result_code_print(ndo
, ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
555 pptp_err_code_print(ndo
, ptr
->err_code
);
556 pptp_framing_cap_print(ndo
, ptr
->framing_cap
);
557 pptp_bearer_cap_print(ndo
, ptr
->bearer_cap
);
558 pptp_max_channel_print(ndo
, ptr
->max_channel
);
559 pptp_firm_rev_print(ndo
, ptr
->firm_rev
);
560 pptp_hostname_print(ndo
, ptr
->hostname
);
561 pptp_vendor_print(ndo
, ptr
->vendor
);
565 pptp_stopccrq_print(netdissect_options
*ndo
,
568 const struct pptp_msg_stopccrq
*ptr
= (const struct pptp_msg_stopccrq
*)dat
;
570 ND_PRINT(" REASON(%u", GET_U_1(ptr
->reason
));
571 if (ndo
->ndo_vflag
) {
572 switch (GET_U_1(ptr
->reason
)) {
577 ND_PRINT(":Stop-Protocol");
580 ND_PRINT(":Stop-Local-Shutdown");
588 PRINT_RESERVED_IF_NOT_ZERO_1(ptr
->reserved1
);
589 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved2
);
593 pptp_stopccrp_print(netdissect_options
*ndo
,
596 const struct pptp_msg_stopccrp
*ptr
= (const struct pptp_msg_stopccrp
*)dat
;
598 pptp_result_code_print(ndo
, ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
599 pptp_err_code_print(ndo
, ptr
->err_code
);
600 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
604 pptp_echorq_print(netdissect_options
*ndo
,
607 const struct pptp_msg_echorq
*ptr
= (const struct pptp_msg_echorq
*)dat
;
609 pptp_id_print(ndo
, ptr
->id
);
613 pptp_echorp_print(netdissect_options
*ndo
,
616 const struct pptp_msg_echorp
*ptr
= (const struct pptp_msg_echorp
*)dat
;
618 pptp_id_print(ndo
, ptr
->id
);
619 pptp_result_code_print(ndo
, ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
620 pptp_err_code_print(ndo
, ptr
->err_code
);
621 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
625 pptp_ocrq_print(netdissect_options
*ndo
,
628 const struct pptp_msg_ocrq
*ptr
= (const struct pptp_msg_ocrq
*)dat
;
630 pptp_call_id_print(ndo
, ptr
->call_id
);
631 pptp_call_ser_print(ndo
, ptr
->call_ser
);
632 ND_PRINT(" MIN_BPS(%u)", GET_BE_U_4(ptr
->min_bps
));
633 ND_PRINT(" MAX_BPS(%u)", GET_BE_U_4(ptr
->max_bps
));
634 pptp_bearer_type_print(ndo
, ptr
->bearer_type
);
635 pptp_framing_type_print(ndo
, ptr
->framing_type
);
636 pptp_recv_winsiz_print(ndo
, ptr
->recv_winsiz
);
637 pptp_pkt_proc_delay_print(ndo
, ptr
->pkt_proc_delay
);
638 ND_PRINT(" PHONE_NO_LEN(%u)", GET_BE_U_2(ptr
->phone_no_len
));
639 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
640 ND_PRINT(" PHONE_NO(");
641 nd_printjnp(ndo
, ptr
->phone_no
,
642 ND_MIN(64, GET_BE_U_2(ptr
->phone_no_len
)));
644 pptp_subaddr_print(ndo
, ptr
->subaddr
);
648 pptp_ocrp_print(netdissect_options
*ndo
,
651 const struct pptp_msg_ocrp
*ptr
= (const struct pptp_msg_ocrp
*)dat
;
653 pptp_call_id_print(ndo
, ptr
->call_id
);
654 pptp_peer_call_id_print(ndo
, ptr
->peer_call_id
);
655 pptp_result_code_print(ndo
, ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
656 pptp_err_code_print(ndo
, ptr
->err_code
);
657 pptp_cause_code_print(ndo
, ptr
->cause_code
);
658 pptp_conn_speed_print(ndo
, ptr
->conn_speed
);
659 pptp_recv_winsiz_print(ndo
, ptr
->recv_winsiz
);
660 pptp_pkt_proc_delay_print(ndo
, ptr
->pkt_proc_delay
);
661 pptp_phy_chan_id_print(ndo
, ptr
->phy_chan_id
);
665 pptp_icrq_print(netdissect_options
*ndo
,
668 const struct pptp_msg_icrq
*ptr
= (const struct pptp_msg_icrq
*)dat
;
670 pptp_call_id_print(ndo
, ptr
->call_id
);
671 pptp_call_ser_print(ndo
, ptr
->call_ser
);
672 pptp_bearer_type_print(ndo
, ptr
->bearer_type
);
673 pptp_phy_chan_id_print(ndo
, ptr
->phy_chan_id
);
674 ND_PRINT(" DIALED_NO_LEN(%u)", GET_BE_U_2(ptr
->dialed_no_len
));
675 ND_PRINT(" DIALING_NO_LEN(%u)", GET_BE_U_2(ptr
->dialing_no_len
));
676 ND_PRINT(" DIALED_NO(");
677 nd_printjnp(ndo
, ptr
->dialed_no
,
678 ND_MIN(64, GET_BE_U_2(ptr
->dialed_no_len
)));
680 ND_PRINT(" DIALING_NO(");
681 nd_printjnp(ndo
, ptr
->dialing_no
,
682 ND_MIN(64, GET_BE_U_2(ptr
->dialing_no_len
)));
684 pptp_subaddr_print(ndo
, ptr
->subaddr
);
688 pptp_icrp_print(netdissect_options
*ndo
,
691 const struct pptp_msg_icrp
*ptr
= (const struct pptp_msg_icrp
*)dat
;
693 pptp_call_id_print(ndo
, ptr
->call_id
);
694 pptp_peer_call_id_print(ndo
, ptr
->peer_call_id
);
695 pptp_result_code_print(ndo
, ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
696 pptp_err_code_print(ndo
, ptr
->err_code
);
697 pptp_recv_winsiz_print(ndo
, ptr
->recv_winsiz
);
698 pptp_pkt_proc_delay_print(ndo
, ptr
->pkt_proc_delay
);
699 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
703 pptp_iccn_print(netdissect_options
*ndo
,
706 const struct pptp_msg_iccn
*ptr
= (const struct pptp_msg_iccn
*)dat
;
708 pptp_peer_call_id_print(ndo
, ptr
->peer_call_id
);
709 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
710 pptp_conn_speed_print(ndo
, ptr
->conn_speed
);
711 pptp_recv_winsiz_print(ndo
, ptr
->recv_winsiz
);
712 pptp_pkt_proc_delay_print(ndo
, ptr
->pkt_proc_delay
);
713 pptp_framing_type_print(ndo
, ptr
->framing_type
);
717 pptp_ccrq_print(netdissect_options
*ndo
,
720 const struct pptp_msg_ccrq
*ptr
= (const struct pptp_msg_ccrq
*)dat
;
722 pptp_call_id_print(ndo
, ptr
->call_id
);
723 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
727 pptp_cdn_print(netdissect_options
*ndo
,
730 const struct pptp_msg_cdn
*ptr
= (const struct pptp_msg_cdn
*)dat
;
732 pptp_call_id_print(ndo
, ptr
->call_id
);
733 pptp_result_code_print(ndo
, ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
734 pptp_err_code_print(ndo
, ptr
->err_code
);
735 pptp_cause_code_print(ndo
, ptr
->cause_code
);
736 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
737 ND_PRINT(" CALL_STATS(");
738 nd_printjnp(ndo
, ptr
->call_stats
, 128);
743 pptp_wen_print(netdissect_options
*ndo
,
746 const struct pptp_msg_wen
*ptr
= (const struct pptp_msg_wen
*)dat
;
748 pptp_peer_call_id_print(ndo
, ptr
->peer_call_id
);
749 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
750 ND_PRINT(" CRC_ERR(%u)", GET_BE_U_4(ptr
->crc_err
));
751 ND_PRINT(" FRAMING_ERR(%u)", GET_BE_U_4(ptr
->framing_err
));
752 ND_PRINT(" HARDWARE_OVERRUN(%u)", GET_BE_U_4(ptr
->hardware_overrun
));
753 ND_PRINT(" BUFFER_OVERRUN(%u)", GET_BE_U_4(ptr
->buffer_overrun
));
754 ND_PRINT(" TIMEOUT_ERR(%u)", GET_BE_U_4(ptr
->timeout_err
));
755 ND_PRINT(" ALIGN_ERR(%u)", GET_BE_U_4(ptr
->align_err
));
759 pptp_sli_print(netdissect_options
*ndo
,
762 const struct pptp_msg_sli
*ptr
= (const struct pptp_msg_sli
*)dat
;
764 pptp_peer_call_id_print(ndo
, ptr
->peer_call_id
);
765 PRINT_RESERVED_IF_NOT_ZERO_2(ptr
->reserved1
);
766 ND_PRINT(" SEND_ACCM(0x%08x)", GET_BE_U_4(ptr
->send_accm
));
767 ND_PRINT(" RECV_ACCM(0x%08x)", GET_BE_U_4(ptr
->recv_accm
));
771 pptp_print(netdissect_options
*ndo
,
774 const struct pptp_hdr
*hdr
;
776 uint16_t ctrl_msg_type
;
778 ndo
->ndo_protocol
= "pptp";
780 nd_print_protocol(ndo
);
782 hdr
= (const struct pptp_hdr
*)dat
;
784 if (ndo
->ndo_vflag
) {
785 ND_PRINT(" Length=%u", GET_BE_U_2(hdr
->length
));
787 if (ndo
->ndo_vflag
) {
788 switch(GET_BE_U_2(hdr
->msg_type
)) {
789 case PPTP_MSG_TYPE_CTRL
:
790 ND_PRINT(" CTRL-MSG");
792 case PPTP_MSG_TYPE_MGMT
:
793 ND_PRINT(" MGMT-MSG");
796 ND_PRINT(" UNKNOWN-MSG-TYPE");
801 mc
= GET_BE_U_4(hdr
->magic_cookie
);
802 if (mc
!= PPTP_MAGIC_COOKIE
) {
803 ND_PRINT(" UNEXPECTED Magic-Cookie!!(%08x)", mc
);
805 if (ndo
->ndo_vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
806 ND_PRINT(" Magic-Cookie=%08x", mc
);
808 ctrl_msg_type
= GET_BE_U_2(hdr
->ctrl_msg_type
);
809 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
810 ND_PRINT(" CTRL_MSGTYPE=%s",
811 pptp_message_type_string
[ctrl_msg_type
]);
813 ND_PRINT(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
);
815 PRINT_RESERVED_IF_NOT_ZERO_2(hdr
->reserved0
);
819 switch(ctrl_msg_type
) {
820 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
821 pptp_sccrq_print(ndo
, dat
);
823 case PPTP_CTRL_MSG_TYPE_SCCRP
:
824 pptp_sccrp_print(ndo
, dat
);
826 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
827 pptp_stopccrq_print(ndo
, dat
);
829 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
830 pptp_stopccrp_print(ndo
, dat
);
832 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
833 pptp_echorq_print(ndo
, dat
);
835 case PPTP_CTRL_MSG_TYPE_ECHORP
:
836 pptp_echorp_print(ndo
, dat
);
838 case PPTP_CTRL_MSG_TYPE_OCRQ
:
839 pptp_ocrq_print(ndo
, dat
);
841 case PPTP_CTRL_MSG_TYPE_OCRP
:
842 pptp_ocrp_print(ndo
, dat
);
844 case PPTP_CTRL_MSG_TYPE_ICRQ
:
845 pptp_icrq_print(ndo
, dat
);
847 case PPTP_CTRL_MSG_TYPE_ICRP
:
848 pptp_icrp_print(ndo
, dat
);
850 case PPTP_CTRL_MSG_TYPE_ICCN
:
851 pptp_iccn_print(ndo
, dat
);
853 case PPTP_CTRL_MSG_TYPE_CCRQ
:
854 pptp_ccrq_print(ndo
, dat
);
856 case PPTP_CTRL_MSG_TYPE_CDN
:
857 pptp_cdn_print(ndo
, dat
);
859 case PPTP_CTRL_MSG_TYPE_WEN
:
860 pptp_wen_print(ndo
, dat
);
862 case PPTP_CTRL_MSG_TYPE_SLI
:
863 pptp_sli_print(ndo
, dat
);