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 #include <sys/cdefs.h>
26 __RCSID("$NetBSD: print-pptp.c,v 1.4 2014/11/20 03:05:03 christos Exp $");
29 #define NETDISSECT_REWORKED
34 #include <tcpdump-stdinc.h>
36 #include "interface.h"
39 static const char tstr
[] = " [|pptp]";
41 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
42 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
43 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
45 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
46 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
47 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
48 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
49 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
50 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
51 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
52 #define PPTP_CTRL_MSG_TYPE_OCRP 8
53 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
54 #define PPTP_CTRL_MSG_TYPE_ICRP 10
55 #define PPTP_CTRL_MSG_TYPE_ICCN 11
56 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
57 #define PPTP_CTRL_MSG_TYPE_CDN 13
58 #define PPTP_CTRL_MSG_TYPE_WEN 14
59 #define PPTP_CTRL_MSG_TYPE_SLI 15
61 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
62 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
64 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
65 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
67 static const char *pptp_message_type_string
[] = {
68 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
69 "SCCRQ", /* 1 Start-Control-Connection-Request */
70 "SCCRP", /* 2 Start-Control-Connection-Reply */
71 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
72 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
73 "ECHORQ", /* 5 Echo Request */
74 "ECHORP", /* 6 Echo Reply */
76 "OCRQ", /* 7 Outgoing-Call-Request */
77 "OCRP", /* 8 Outgoing-Call-Reply */
78 "ICRQ", /* 9 Incoming-Call-Request */
79 "ICRP", /* 10 Incoming-Call-Reply */
80 "ICCN", /* 11 Incoming-Call-Connected */
81 "CCRQ", /* 12 Call-Clear-Request */
82 "CDN", /* 13 Call-Disconnect-Notify */
84 "WEN", /* 14 WAN-Error-Notify */
86 "SLI" /* 15 Set-Link-Info */
87 #define PPTP_MAX_MSGTYPE_INDEX 16
90 /* common for all PPTP control messages */
94 uint32_t magic_cookie
;
95 uint16_t ctrl_msg_type
;
99 struct pptp_msg_sccrq
{
102 uint32_t framing_cap
;
104 uint16_t max_channel
;
110 struct pptp_msg_sccrp
{
114 uint32_t framing_cap
;
116 uint16_t max_channel
;
122 struct pptp_msg_stopccrq
{
128 struct pptp_msg_stopccrp
{
134 struct pptp_msg_echorq
{
138 struct pptp_msg_echorp
{
145 struct pptp_msg_ocrq
{
150 uint32_t bearer_type
;
151 uint32_t framing_type
;
152 uint16_t recv_winsiz
;
153 uint16_t pkt_proc_delay
;
154 uint16_t phone_no_len
;
160 struct pptp_msg_ocrp
{
162 uint16_t peer_call_id
;
167 uint16_t recv_winsiz
;
168 uint16_t pkt_proc_delay
;
169 uint32_t phy_chan_id
;
172 struct pptp_msg_icrq
{
175 uint32_t bearer_type
;
176 uint32_t phy_chan_id
;
177 uint16_t dialed_no_len
;
178 uint16_t dialing_no_len
;
179 u_char dialed_no
[64]; /* DNIS */
180 u_char dialing_no
[64]; /* CLID */
184 struct pptp_msg_icrp
{
186 uint16_t peer_call_id
;
189 uint16_t recv_winsiz
;
190 uint16_t pkt_proc_delay
;
194 struct pptp_msg_iccn
{
195 uint16_t peer_call_id
;
198 uint16_t recv_winsiz
;
199 uint16_t pkt_proc_delay
;
200 uint32_t framing_type
;
203 struct pptp_msg_ccrq
{
208 struct pptp_msg_cdn
{
214 u_char call_stats
[128];
217 struct pptp_msg_wen
{
218 uint16_t peer_call_id
;
221 uint32_t framing_err
;
222 uint32_t hardware_overrun
;
223 uint32_t buffer_overrun
;
224 uint32_t timeout_err
;
228 struct pptp_msg_sli
{
229 uint16_t peer_call_id
;
235 /* attributes that appear more than once in above messages:
239 --------------------------------------
240 2 uint32_t bearer_cap;
241 2 uint32_t bearer_type;
244 2 uint16_t cause_code;
245 2 uint32_t conn_speed;
248 2 uint32_t framing_cap;
249 2 uint32_t framing_type;
250 2 u_char hostname[64];
252 2 uint16_t max_channel;
253 5 uint16_t peer_call_id;
254 2 uint32_t phy_chan_id;
255 4 uint16_t pkt_proc_delay;
256 2 uint16_t proto_ver;
257 4 uint16_t recv_winsiz;
259 9 uint16_t reserved1;
260 6 uint8_t result_code;
261 2 u_char subaddr[64];
264 so I will prepare print out functions for these attributes (except for
268 /******************************************/
269 /* Attribute-specific print out functions */
270 /******************************************/
272 /* In these attribute-specific print-out functions, it't not necessary
273 to do ND_TCHECK because they are already checked in the caller of
277 pptp_bearer_cap_print(netdissect_options
*ndo
,
278 const uint32_t *bearer_cap
)
280 ND_PRINT((ndo
, " BEARER_CAP(%s%s)",
281 EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
? "D" : "",
282 EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
? "A" : ""));
285 static const struct tok pptp_btype_str
[] = {
286 { 1, "A" }, /* Analog */
287 { 2, "D" }, /* Digital */
293 pptp_bearer_type_print(netdissect_options
*ndo
,
294 const uint32_t *bearer_type
)
296 ND_PRINT((ndo
, " BEARER_TYPE(%s)",
297 tok2str(pptp_btype_str
, "?", EXTRACT_32BITS(bearer_type
))));
301 pptp_call_id_print(netdissect_options
*ndo
,
302 const uint16_t *call_id
)
304 ND_PRINT((ndo
, " CALL_ID(%u)", EXTRACT_16BITS(call_id
)));
308 pptp_call_ser_print(netdissect_options
*ndo
,
309 const uint16_t *call_ser
)
311 ND_PRINT((ndo
, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser
)));
315 pptp_cause_code_print(netdissect_options
*ndo
,
316 const uint16_t *cause_code
)
318 ND_PRINT((ndo
, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code
)));
322 pptp_conn_speed_print(netdissect_options
*ndo
,
323 const uint32_t *conn_speed
)
325 ND_PRINT((ndo
, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed
)));
328 static const struct tok pptp_errcode_str
[] = {
330 { 1, "Not-Connected" },
333 { 4, "No-Resource" },
334 { 5, "Bad-Call-ID" },
340 pptp_err_code_print(netdissect_options
*ndo
,
341 const uint8_t *err_code
)
343 ND_PRINT((ndo
, " ERR_CODE(%u", *err_code
));
344 if (ndo
->ndo_vflag
) {
345 ND_PRINT((ndo
, ":%s", tok2str(pptp_errcode_str
, "?", *err_code
)));
347 ND_PRINT((ndo
, ")"));
351 pptp_firm_rev_print(netdissect_options
*ndo
,
352 const uint16_t *firm_rev
)
354 ND_PRINT((ndo
, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev
)));
358 pptp_framing_cap_print(netdissect_options
*ndo
,
359 const uint32_t *framing_cap
)
361 ND_PRINT((ndo
, " FRAME_CAP("));
362 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
363 ND_PRINT((ndo
, "A")); /* Async */
365 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
366 ND_PRINT((ndo
, "S")); /* Sync */
368 ND_PRINT((ndo
, ")"));
371 static const struct tok pptp_ftype_str
[] = {
372 { 1, "A" }, /* Async */
373 { 2, "S" }, /* Sync */
374 { 3, "E" }, /* Either */
379 pptp_framing_type_print(netdissect_options
*ndo
,
380 const uint32_t *framing_type
)
382 ND_PRINT((ndo
, " FRAME_TYPE(%s)",
383 tok2str(pptp_ftype_str
, "?", EXTRACT_32BITS(framing_type
))));
387 pptp_hostname_print(netdissect_options
*ndo
,
388 const u_char
*hostname
)
390 ND_PRINT((ndo
, " HOSTNAME(%.64s)", hostname
));
394 pptp_id_print(netdissect_options
*ndo
,
397 ND_PRINT((ndo
, " ID(%u)", EXTRACT_32BITS(id
)));
401 pptp_max_channel_print(netdissect_options
*ndo
,
402 const uint16_t *max_channel
)
404 ND_PRINT((ndo
, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel
)));
408 pptp_peer_call_id_print(netdissect_options
*ndo
,
409 const uint16_t *peer_call_id
)
411 ND_PRINT((ndo
, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id
)));
415 pptp_phy_chan_id_print(netdissect_options
*ndo
,
416 const uint32_t *phy_chan_id
)
418 ND_PRINT((ndo
, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id
)));
422 pptp_pkt_proc_delay_print(netdissect_options
*ndo
,
423 const uint16_t *pkt_proc_delay
)
425 ND_PRINT((ndo
, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay
)));
429 pptp_proto_ver_print(netdissect_options
*ndo
,
430 const uint16_t *proto_ver
)
432 ND_PRINT((ndo
, " PROTO_VER(%u.%u)", /* Version.Revision */
433 EXTRACT_16BITS(proto_ver
) >> 8,
434 EXTRACT_16BITS(proto_ver
) & 0xff));
438 pptp_recv_winsiz_print(netdissect_options
*ndo
,
439 const uint16_t *recv_winsiz
)
441 ND_PRINT((ndo
, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz
)));
444 static const struct tok pptp_scrrp_str
[] = {
445 { 1, "Successful channel establishment" },
446 { 2, "General error" },
447 { 3, "Command channel already exists" },
448 { 4, "Requester is not authorized to establish a command channel" },
449 { 5, "The protocol version of the requester is not supported" },
453 static const struct tok pptp_echorp_str
[] = {
455 { 2, "General Error" },
459 static const struct tok pptp_ocrp_str
[] = {
461 { 2, "General Error" },
464 { 5, "No Dial Tone" },
466 { 7, "Do Not Accept" },
470 static const struct tok pptp_icrp_str
[] = {
472 { 2, "General Error" },
473 { 3, "Do Not Accept" },
477 static const struct tok pptp_cdn_str
[] = {
478 { 1, "Lost Carrier" },
479 { 2, "General Error" },
480 { 3, "Admin Shutdown" },
486 pptp_result_code_print(netdissect_options
*ndo
,
487 const uint8_t *result_code
, int ctrl_msg_type
)
489 ND_PRINT((ndo
, " RESULT_CODE(%u", *result_code
));
490 if (ndo
->ndo_vflag
) {
491 const struct tok
*dict
=
492 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_SCCRP
? pptp_scrrp_str
:
493 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_StopCCRP
? pptp_echorp_str
:
494 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ECHORP
? pptp_echorp_str
:
495 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_OCRP
? pptp_ocrp_str
:
496 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ICRP
? pptp_icrp_str
:
497 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_CDN
? pptp_cdn_str
:
498 NULL
; /* assertion error */
500 ND_PRINT((ndo
, ":%s", tok2str(dict
, "?", *result_code
)));
502 ND_PRINT((ndo
, ")"));
506 pptp_subaddr_print(netdissect_options
*ndo
,
507 const u_char
*subaddr
)
509 ND_PRINT((ndo
, " SUB_ADDR(%.64s)", subaddr
));
513 pptp_vendor_print(netdissect_options
*ndo
,
514 const u_char
*vendor
)
516 ND_PRINT((ndo
, " VENDOR(%.64s)", vendor
));
519 /************************************/
520 /* PPTP message print out functions */
521 /************************************/
523 pptp_sccrq_print(netdissect_options
*ndo
,
526 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
528 ND_TCHECK(ptr
->proto_ver
);
529 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
530 ND_TCHECK(ptr
->reserved1
);
531 ND_TCHECK(ptr
->framing_cap
);
532 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
533 ND_TCHECK(ptr
->bearer_cap
);
534 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
535 ND_TCHECK(ptr
->max_channel
);
536 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
537 ND_TCHECK(ptr
->firm_rev
);
538 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
539 ND_TCHECK(ptr
->hostname
);
540 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
541 ND_TCHECK(ptr
->vendor
);
542 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
547 ND_PRINT((ndo
, "%s", tstr
));
551 pptp_sccrp_print(netdissect_options
*ndo
,
554 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
556 ND_TCHECK(ptr
->proto_ver
);
557 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
558 ND_TCHECK(ptr
->result_code
);
559 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
560 ND_TCHECK(ptr
->err_code
);
561 pptp_err_code_print(ndo
, &ptr
->err_code
);
562 ND_TCHECK(ptr
->framing_cap
);
563 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
564 ND_TCHECK(ptr
->bearer_cap
);
565 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
566 ND_TCHECK(ptr
->max_channel
);
567 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
568 ND_TCHECK(ptr
->firm_rev
);
569 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
570 ND_TCHECK(ptr
->hostname
);
571 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
572 ND_TCHECK(ptr
->vendor
);
573 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
578 ND_PRINT((ndo
, "%s", tstr
));
582 pptp_stopccrq_print(netdissect_options
*ndo
,
585 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
587 ND_TCHECK(ptr
->reason
);
588 ND_PRINT((ndo
, " REASON(%u", ptr
->reason
));
589 if (ndo
->ndo_vflag
) {
590 switch (ptr
->reason
) {
592 ND_PRINT((ndo
, ":None"));
595 ND_PRINT((ndo
, ":Stop-Protocol"));
598 ND_PRINT((ndo
, ":Stop-Local-Shutdown"));
601 ND_PRINT((ndo
, ":?"));
605 ND_PRINT((ndo
, ")"));
606 ND_TCHECK(ptr
->reserved1
);
607 ND_TCHECK(ptr
->reserved2
);
612 ND_PRINT((ndo
, "%s", tstr
));
616 pptp_stopccrp_print(netdissect_options
*ndo
,
619 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
621 ND_TCHECK(ptr
->result_code
);
622 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
623 ND_TCHECK(ptr
->err_code
);
624 pptp_err_code_print(ndo
, &ptr
->err_code
);
625 ND_TCHECK(ptr
->reserved1
);
630 ND_PRINT((ndo
, "%s", tstr
));
634 pptp_echorq_print(netdissect_options
*ndo
,
637 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
640 pptp_id_print(ndo
, &ptr
->id
);
645 ND_PRINT((ndo
, "%s", tstr
));
649 pptp_echorp_print(netdissect_options
*ndo
,
652 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
655 pptp_id_print(ndo
, &ptr
->id
);
656 ND_TCHECK(ptr
->result_code
);
657 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
658 ND_TCHECK(ptr
->err_code
);
659 pptp_err_code_print(ndo
, &ptr
->err_code
);
660 ND_TCHECK(ptr
->reserved1
);
665 ND_PRINT((ndo
, "%s", tstr
));
669 pptp_ocrq_print(netdissect_options
*ndo
,
672 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
674 ND_TCHECK(ptr
->call_id
);
675 pptp_call_id_print(ndo
, &ptr
->call_id
);
676 ND_TCHECK(ptr
->call_ser
);
677 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
678 ND_TCHECK(ptr
->min_bps
);
679 ND_PRINT((ndo
, " MIN_BPS(%u)", EXTRACT_32BITS(&ptr
->min_bps
)));
680 ND_TCHECK(ptr
->max_bps
);
681 ND_PRINT((ndo
, " MAX_BPS(%u)", EXTRACT_32BITS(&ptr
->max_bps
)));
682 ND_TCHECK(ptr
->bearer_type
);
683 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
684 ND_TCHECK(ptr
->framing_type
);
685 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
686 ND_TCHECK(ptr
->recv_winsiz
);
687 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
688 ND_TCHECK(ptr
->pkt_proc_delay
);
689 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
690 ND_TCHECK(ptr
->phone_no_len
);
691 ND_PRINT((ndo
, " PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->phone_no_len
)));
692 ND_TCHECK(ptr
->reserved1
);
693 ND_TCHECK(ptr
->phone_no
);
694 ND_PRINT((ndo
, " PHONE_NO(%.64s)", ptr
->phone_no
));
695 ND_TCHECK(ptr
->subaddr
);
696 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
701 ND_PRINT((ndo
, "%s", tstr
));
705 pptp_ocrp_print(netdissect_options
*ndo
,
708 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
710 ND_TCHECK(ptr
->call_id
);
711 pptp_call_id_print(ndo
, &ptr
->call_id
);
712 ND_TCHECK(ptr
->peer_call_id
);
713 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
714 ND_TCHECK(ptr
->result_code
);
715 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
716 ND_TCHECK(ptr
->err_code
);
717 pptp_err_code_print(ndo
, &ptr
->err_code
);
718 ND_TCHECK(ptr
->cause_code
);
719 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
720 ND_TCHECK(ptr
->conn_speed
);
721 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
722 ND_TCHECK(ptr
->recv_winsiz
);
723 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
724 ND_TCHECK(ptr
->pkt_proc_delay
);
725 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
726 ND_TCHECK(ptr
->phy_chan_id
);
727 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
732 ND_PRINT((ndo
, "%s", tstr
));
736 pptp_icrq_print(netdissect_options
*ndo
,
739 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
741 ND_TCHECK(ptr
->call_id
);
742 pptp_call_id_print(ndo
, &ptr
->call_id
);
743 ND_TCHECK(ptr
->call_ser
);
744 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
745 ND_TCHECK(ptr
->bearer_type
);
746 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
747 ND_TCHECK(ptr
->phy_chan_id
);
748 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
749 ND_TCHECK(ptr
->dialed_no_len
);
750 ND_PRINT((ndo
, " DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialed_no_len
)));
751 ND_TCHECK(ptr
->dialing_no_len
);
752 ND_PRINT((ndo
, " DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialing_no_len
)));
753 ND_TCHECK(ptr
->dialed_no
);
754 ND_PRINT((ndo
, " DIALED_NO(%.64s)", ptr
->dialed_no
));
755 ND_TCHECK(ptr
->dialing_no
);
756 ND_PRINT((ndo
, " DIALING_NO(%.64s)", ptr
->dialing_no
));
757 ND_TCHECK(ptr
->subaddr
);
758 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
763 ND_PRINT((ndo
, "%s", tstr
));
767 pptp_icrp_print(netdissect_options
*ndo
,
770 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
772 ND_TCHECK(ptr
->call_id
);
773 pptp_call_id_print(ndo
, &ptr
->call_id
);
774 ND_TCHECK(ptr
->peer_call_id
);
775 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
776 ND_TCHECK(ptr
->result_code
);
777 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
778 ND_TCHECK(ptr
->err_code
);
779 pptp_err_code_print(ndo
, &ptr
->err_code
);
780 ND_TCHECK(ptr
->recv_winsiz
);
781 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
782 ND_TCHECK(ptr
->pkt_proc_delay
);
783 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
784 ND_TCHECK(ptr
->reserved1
);
789 ND_PRINT((ndo
, "%s", tstr
));
793 pptp_iccn_print(netdissect_options
*ndo
,
796 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
798 ND_TCHECK(ptr
->peer_call_id
);
799 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
800 ND_TCHECK(ptr
->reserved1
);
801 ND_TCHECK(ptr
->conn_speed
);
802 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
803 ND_TCHECK(ptr
->recv_winsiz
);
804 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
805 ND_TCHECK(ptr
->pkt_proc_delay
);
806 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
807 ND_TCHECK(ptr
->framing_type
);
808 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
813 ND_PRINT((ndo
, "%s", tstr
));
817 pptp_ccrq_print(netdissect_options
*ndo
,
820 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
822 ND_TCHECK(ptr
->call_id
);
823 pptp_call_id_print(ndo
, &ptr
->call_id
);
824 ND_TCHECK(ptr
->reserved1
);
829 ND_PRINT((ndo
, "%s", tstr
));
833 pptp_cdn_print(netdissect_options
*ndo
,
836 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
838 ND_TCHECK(ptr
->call_id
);
839 pptp_call_id_print(ndo
, &ptr
->call_id
);
840 ND_TCHECK(ptr
->result_code
);
841 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
842 ND_TCHECK(ptr
->err_code
);
843 pptp_err_code_print(ndo
, &ptr
->err_code
);
844 ND_TCHECK(ptr
->cause_code
);
845 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
846 ND_TCHECK(ptr
->reserved1
);
847 ND_TCHECK(ptr
->call_stats
);
848 ND_PRINT((ndo
, " CALL_STATS(%.128s)", ptr
->call_stats
));
853 ND_PRINT((ndo
, "%s", tstr
));
857 pptp_wen_print(netdissect_options
*ndo
,
860 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
862 ND_TCHECK(ptr
->peer_call_id
);
863 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
864 ND_TCHECK(ptr
->reserved1
);
865 ND_TCHECK(ptr
->crc_err
);
866 ND_PRINT((ndo
, " CRC_ERR(%u)", EXTRACT_32BITS(&ptr
->crc_err
)));
867 ND_TCHECK(ptr
->framing_err
);
868 ND_PRINT((ndo
, " FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr
->framing_err
)));
869 ND_TCHECK(ptr
->hardware_overrun
);
870 ND_PRINT((ndo
, " HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->hardware_overrun
)));
871 ND_TCHECK(ptr
->buffer_overrun
);
872 ND_PRINT((ndo
, " BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->buffer_overrun
)));
873 ND_TCHECK(ptr
->timeout_err
);
874 ND_PRINT((ndo
, " TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr
->timeout_err
)));
875 ND_TCHECK(ptr
->align_err
);
876 ND_PRINT((ndo
, " ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr
->align_err
)));
881 ND_PRINT((ndo
, "%s", tstr
));
885 pptp_sli_print(netdissect_options
*ndo
,
888 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
890 ND_TCHECK(ptr
->peer_call_id
);
891 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
892 ND_TCHECK(ptr
->reserved1
);
893 ND_TCHECK(ptr
->send_accm
);
894 ND_PRINT((ndo
, " SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->send_accm
)));
895 ND_TCHECK(ptr
->recv_accm
);
896 ND_PRINT((ndo
, " RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->recv_accm
)));
901 ND_PRINT((ndo
, "%s", tstr
));
905 pptp_print(netdissect_options
*ndo
,
908 const struct pptp_hdr
*hdr
;
910 uint16_t ctrl_msg_type
;
912 ND_PRINT((ndo
, ": pptp"));
914 hdr
= (struct pptp_hdr
*)dat
;
916 ND_TCHECK(hdr
->length
);
917 if (ndo
->ndo_vflag
) {
918 ND_PRINT((ndo
, " Length=%u", EXTRACT_16BITS(&hdr
->length
)));
920 ND_TCHECK(hdr
->msg_type
);
921 if (ndo
->ndo_vflag
) {
922 switch(EXTRACT_16BITS(&hdr
->msg_type
)) {
923 case PPTP_MSG_TYPE_CTRL
:
924 ND_PRINT((ndo
, " CTRL-MSG"));
926 case PPTP_MSG_TYPE_MGMT
:
927 ND_PRINT((ndo
, " MGMT-MSG"));
930 ND_PRINT((ndo
, " UNKNOWN-MSG-TYPE"));
935 ND_TCHECK(hdr
->magic_cookie
);
936 mc
= EXTRACT_32BITS(&hdr
->magic_cookie
);
937 if (mc
!= PPTP_MAGIC_COOKIE
) {
938 ND_PRINT((ndo
, " UNEXPECTED Magic-Cookie!!(%08x)", mc
));
940 if (ndo
->ndo_vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
941 ND_PRINT((ndo
, " Magic-Cookie=%08x", mc
));
943 ND_TCHECK(hdr
->ctrl_msg_type
);
944 ctrl_msg_type
= EXTRACT_16BITS(&hdr
->ctrl_msg_type
);
945 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
946 ND_PRINT((ndo
, " CTRL_MSGTYPE=%s",
947 pptp_message_type_string
[ctrl_msg_type
]));
949 ND_PRINT((ndo
, " UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
));
951 ND_TCHECK(hdr
->reserved0
);
955 switch(ctrl_msg_type
) {
956 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
957 pptp_sccrq_print(ndo
, dat
);
959 case PPTP_CTRL_MSG_TYPE_SCCRP
:
960 pptp_sccrp_print(ndo
, dat
);
962 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
963 pptp_stopccrq_print(ndo
, dat
);
965 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
966 pptp_stopccrp_print(ndo
, dat
);
968 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
969 pptp_echorq_print(ndo
, dat
);
971 case PPTP_CTRL_MSG_TYPE_ECHORP
:
972 pptp_echorp_print(ndo
, dat
);
974 case PPTP_CTRL_MSG_TYPE_OCRQ
:
975 pptp_ocrq_print(ndo
, dat
);
977 case PPTP_CTRL_MSG_TYPE_OCRP
:
978 pptp_ocrp_print(ndo
, dat
);
980 case PPTP_CTRL_MSG_TYPE_ICRQ
:
981 pptp_icrq_print(ndo
, dat
);
983 case PPTP_CTRL_MSG_TYPE_ICRP
:
984 pptp_icrp_print(ndo
, dat
);
986 case PPTP_CTRL_MSG_TYPE_ICCN
:
987 pptp_iccn_print(ndo
, dat
);
989 case PPTP_CTRL_MSG_TYPE_CCRQ
:
990 pptp_ccrq_print(ndo
, dat
);
992 case PPTP_CTRL_MSG_TYPE_CDN
:
993 pptp_cdn_print(ndo
, dat
);
995 case PPTP_CTRL_MSG_TYPE_WEN
:
996 pptp_wen_print(ndo
, dat
);
998 case PPTP_CTRL_MSG_TYPE_SLI
:
999 pptp_sli_print(ndo
, dat
);
1009 ND_PRINT((ndo
, "%s", tstr
));