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)
26 static const char rcsid
[] =
27 "@(#) $Header: /tcpdump/master/tcpdump/print-pptp.c,v 1.6 2002-09-05 00:00:17 guy Exp $";
34 #include <tcpdump-stdinc.h>
38 #include "interface.h"
40 static char tstr
[] = " [|pptp]";
50 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
51 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
52 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
54 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
55 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
56 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
57 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
58 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
59 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
60 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
61 #define PPTP_CTRL_MSG_TYPE_OCRP 8
62 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
63 #define PPTP_CTRL_MSG_TYPE_ICRP 10
64 #define PPTP_CTRL_MSG_TYPE_ICCN 11
65 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
66 #define PPTP_CTRL_MSG_TYPE_CDN 13
67 #define PPTP_CTRL_MSG_TYPE_WEN 14
68 #define PPTP_CTRL_MSG_TYPE_SLI 15
70 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
71 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
73 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
74 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
76 static const char *pptp_message_type_string
[] = {
77 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
78 "SCCRQ", /* 1 Start-Control-Connection-Request */
79 "SCCRP", /* 2 Start-Control-Connection-Reply */
80 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
81 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
82 "ECHORQ", /* 5 Echo Request */
83 "ECHORP", /* 6 Echo Reply */
85 "OCRQ", /* 7 Outgoing-Call-Request */
86 "OCRP", /* 8 Outgoing-Call-Reply */
87 "ICRQ", /* 9 Incoming-Call-Request */
88 "ICRP", /* 10 Incoming-Call-Reply */
89 "ICCN", /* 11 Incoming-Call-Connected */
90 "CCRQ", /* 12 Call-Clear-Request */
91 "CDN", /* 13 Call-Disconnect-Notify */
93 "WEN", /* 14 WAN-Error-Notify */
95 "SLI" /* 15 Set-Link-Info */
96 #define PPTP_MAX_MSGTYPE_INDEX 16
99 /* common for all PPTP control messages */
103 u_int32_t magic_cookie
;
104 u_int16_t ctrl_msg_type
;
108 struct pptp_msg_sccrq
{
111 u_int32_t framing_cap
;
112 u_int32_t bearer_cap
;
113 u_int16_t max_channel
;
119 struct pptp_msg_sccrp
{
121 u_int8_t result_code
;
123 u_int32_t framing_cap
;
124 u_int32_t bearer_cap
;
125 u_int16_t max_channel
;
131 struct pptp_msg_stopccrq
{
137 struct pptp_msg_stopccrp
{
138 u_int8_t result_code
;
143 struct pptp_msg_echorq
{
147 struct pptp_msg_echorp
{
149 u_int8_t result_code
;
154 struct pptp_msg_ocrq
{
159 u_int32_t bearer_type
;
160 u_int32_t framing_type
;
161 u_int16_t recv_winsiz
;
162 u_int16_t pkt_proc_delay
;
163 u_int16_t phone_no_len
;
169 struct pptp_msg_ocrp
{
171 u_int16_t peer_call_id
;
172 u_int8_t result_code
;
174 u_int16_t cause_code
;
175 u_int32_t conn_speed
;
176 u_int16_t recv_winsiz
;
177 u_int16_t pkt_proc_delay
;
178 u_int32_t phy_chan_id
;
181 struct pptp_msg_icrq
{
184 u_int32_t bearer_type
;
185 u_int32_t phy_chan_id
;
186 u_int16_t dialed_no_len
;
187 u_int16_t dialing_no_len
;
188 u_char dialed_no
[64]; /* DNIS */
189 u_char dialing_no
[64]; /* CLID */
193 struct pptp_msg_icrp
{
195 u_int16_t peer_call_id
;
196 u_int8_t result_code
;
198 u_int16_t recv_winsiz
;
199 u_int16_t pkt_proc_delay
;
203 struct pptp_msg_iccn
{
204 u_int16_t peer_call_id
;
206 u_int32_t conn_speed
;
207 u_int16_t recv_winsiz
;
208 u_int16_t pkt_proc_delay
;
209 u_int32_t framing_type
;
212 struct pptp_msg_ccrq
{
217 struct pptp_msg_cdn
{
219 u_int8_t result_code
;
221 u_int16_t cause_code
;
223 u_char call_stats
[128];
226 struct pptp_msg_wen
{
227 u_int16_t peer_call_id
;
230 u_int32_t framing_err
;
231 u_int32_t hardware_overrun
;
232 u_int32_t buffer_overrun
;
233 u_int32_t timeout_err
;
237 struct pptp_msg_sli
{
238 u_int16_t peer_call_id
;
244 /* attributes that appear more than once in above messages:
248 --------------------------------------
249 2 u_int32_t bearer_cap;
250 2 u_int32_t bearer_type;
252 2 u_int16_t call_ser;
253 2 u_int16_t cause_code;
254 2 u_int32_t conn_speed;
256 2 u_int16_t firm_rev;
257 2 u_int32_t framing_cap;
258 2 u_int32_t framing_type;
259 2 u_char hostname[64];
261 2 u_int16_t max_channel;
262 5 u_int16_t peer_call_id;
263 2 u_int32_t phy_chan_id;
264 4 u_int16_t pkt_proc_delay;
265 2 u_int16_t proto_ver;
266 4 u_int16_t recv_winsiz;
267 2 u_int8_t reserved1;
268 9 u_int16_t reserved1;
269 6 u_int8_t result_code;
270 2 u_char subaddr[64];
273 so I will prepare print out functions for these attributes (except for
277 /******************************************/
278 /* Attribute-specific print out functions */
279 /******************************************/
281 /* In these attribute-specific print-out functions, it't not necessary
282 to do TCHECK because they are already checked in the caller of
286 pptp_bearer_cap_print(const u_int32_t
*bearer_cap
)
288 printf(" BEARER_CAP(");
289 if (ntohl(*bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
) {
292 if (ntohl(*bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
) {
299 pptp_bearer_type_print(const u_int32_t
*bearer_type
)
301 printf(" BEARER_TYPE(");
302 switch (ntohl(*bearer_type
)) {
304 printf("A"); /* Analog */
307 printf("D"); /* Digital */
320 pptp_call_id_print(const u_int16_t
*call_id
)
322 printf(" CALL_ID(%u)", ntohs(*call_id
));
326 pptp_call_ser_print(const u_int16_t
*call_ser
)
328 printf(" CALL_SER_NUM(%u)", ntohs(*call_ser
));
332 pptp_cause_code_print(const u_int16_t
*cause_code
)
334 printf(" CAUSE_CODE(%u)", ntohs(*cause_code
));
338 pptp_conn_speed_print(const u_int32_t
*conn_speed
)
340 printf(" CONN_SPEED(%lu)", (unsigned long)ntohl(*conn_speed
));
344 pptp_err_code_print(const u_int8_t
*err_code
)
346 printf(" ERR_CODE(%u", *err_code
);
353 printf(":Not-Connected");
356 printf(":Bad-Format");
359 printf(":Bad-Valude");
362 printf(":No-Resource");
365 printf(":Bad-Call-ID");
368 printf(":PAC-Error");
379 pptp_firm_rev_print(const u_int16_t
*firm_rev
)
381 printf(" FIRM_REV(%u)", ntohs(*firm_rev
));
385 pptp_framing_cap_print(const u_int32_t
*framing_cap
)
387 printf(" FRAME_CAP(");
388 if (ntohl(*framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
389 printf("A"); /* Async */
391 if (ntohl(*framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
392 printf("S"); /* Sync */
398 pptp_framing_type_print(const u_int32_t
*framing_type
)
400 printf(" FRAME_TYPE(");
401 switch (ntohl(*framing_type
)) {
403 printf("A"); /* Async */
406 printf("S"); /* Sync */
409 printf("E"); /* Either */
419 pptp_hostname_print(const u_char
*hostname
)
421 printf(" HOSTNAME(%.64s)", hostname
);
425 pptp_id_print(const u_int32_t
*id
)
427 printf(" ID(%lu)", (unsigned long)ntohl(*id
));
431 pptp_max_channel_print(const u_int16_t
*max_channel
)
433 printf(" MAX_CHAN(%u)", ntohs(*max_channel
));
437 pptp_peer_call_id_print(const u_int16_t
*peer_call_id
)
439 printf(" PEER_CALL_ID(%u)", ntohs(*peer_call_id
));
443 pptp_phy_chan_id_print(const u_int32_t
*phy_chan_id
)
445 printf(" PHY_CHAN_ID(%lu)", (unsigned long)ntohl(*phy_chan_id
));
449 pptp_pkt_proc_delay_print(const u_int16_t
*pkt_proc_delay
)
451 printf(" PROC_DELAY(%u)", ntohs(*pkt_proc_delay
));
455 pptp_proto_ver_print(const u_int16_t
*proto_ver
)
457 printf(" PROTO_VER(%u.%u)", /* Version.Revision */
458 ntohs(*proto_ver
) >> 8, ntohs(*proto_ver
) & 0xff);
462 pptp_recv_winsiz_print(const u_int16_t
*recv_winsiz
)
464 printf(" RECV_WIN(%u)", ntohs(*recv_winsiz
));
468 pptp_result_code_print(const u_int8_t
*result_code
, int ctrl_msg_type
)
470 printf(" RESULT_CODE(%u", *result_code
);
472 switch (ctrl_msg_type
) {
473 case PPTP_CTRL_MSG_TYPE_SCCRP
:
474 switch (*result_code
) {
476 printf(":Successful channel establishment");
479 printf(":General error");
482 printf(":Command channel already exists");
485 printf(":Requester is not authorized to establish a command channel");
488 printf(":The protocol version of the requester is not supported");
495 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
496 case PPTP_CTRL_MSG_TYPE_ECHORP
:
497 switch (*result_code
) {
502 printf(":General Error");
509 case PPTP_CTRL_MSG_TYPE_OCRP
:
510 switch (*result_code
) {
512 printf(":Connected");
515 printf(":General Error");
518 printf(":No Carrier");
524 printf(":No Dial Tone");
530 printf(":Do Not Accept");
537 case PPTP_CTRL_MSG_TYPE_ICRP
:
538 switch (*result_code
) {
543 printf(":General Error");
546 printf(":Do Not Accept");
553 case PPTP_CTRL_MSG_TYPE_CDN
:
554 switch (*result_code
) {
556 printf(":Lost Carrier");
559 printf(":General Error");
562 printf(":Admin Shutdown");
572 /* assertion error */
580 pptp_subaddr_print(const u_char
*subaddr
)
582 printf(" SUB_ADDR(%.64s)", subaddr
);
586 pptp_vendor_print(const u_char
*vendor
)
588 printf(" VENDOR(%.64s)", vendor
);
591 /************************************/
592 /* PPTP message print out functions */
593 /************************************/
595 pptp_sccrq_print(const u_char
*dat
)
597 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
599 TCHECK(ptr
->proto_ver
);
600 pptp_proto_ver_print(&ptr
->proto_ver
);
601 TCHECK(ptr
->reserved1
);
602 TCHECK(ptr
->framing_cap
);
603 pptp_framing_cap_print(&ptr
->framing_cap
);
604 TCHECK(ptr
->bearer_cap
);
605 pptp_bearer_cap_print(&ptr
->bearer_cap
);
606 TCHECK(ptr
->max_channel
);
607 pptp_max_channel_print(&ptr
->max_channel
);
608 TCHECK(ptr
->firm_rev
);
609 pptp_firm_rev_print(&ptr
->firm_rev
);
610 TCHECK(ptr
->hostname
);
611 pptp_hostname_print(&ptr
->hostname
[0]);
613 pptp_vendor_print(&ptr
->vendor
[0]);
622 pptp_sccrp_print(const u_char
*dat
)
624 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
626 TCHECK(ptr
->proto_ver
);
627 pptp_proto_ver_print(&ptr
->proto_ver
);
628 TCHECK(ptr
->result_code
);
629 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
630 TCHECK(ptr
->err_code
);
631 pptp_err_code_print(&ptr
->err_code
);
632 TCHECK(ptr
->framing_cap
);
633 pptp_framing_cap_print(&ptr
->framing_cap
);
634 TCHECK(ptr
->bearer_cap
);
635 pptp_bearer_cap_print(&ptr
->bearer_cap
);
636 TCHECK(ptr
->max_channel
);
637 pptp_max_channel_print(&ptr
->max_channel
);
638 TCHECK(ptr
->firm_rev
);
639 pptp_firm_rev_print(&ptr
->firm_rev
);
640 TCHECK(ptr
->hostname
);
641 pptp_hostname_print(&ptr
->hostname
[0]);
643 pptp_vendor_print(&ptr
->vendor
[0]);
652 pptp_stopccrq_print(const u_char
*dat
)
654 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
657 printf(" REASON(%u", ptr
->reason
);
659 switch (ptr
->reason
) {
664 printf(":Stop-Protocol");
667 printf(":Stop-Local-Shutdown");
675 TCHECK(ptr
->reserved1
);
676 TCHECK(ptr
->reserved2
);
685 pptp_stopccrp_print(const u_char
*dat
)
687 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
689 TCHECK(ptr
->result_code
);
690 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
691 TCHECK(ptr
->err_code
);
692 pptp_err_code_print(&ptr
->err_code
);
693 TCHECK(ptr
->reserved1
);
702 pptp_echorq_print(const u_char
*dat
)
704 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
707 pptp_id_print(&ptr
->id
);
716 pptp_echorp_print(const u_char
*dat
)
718 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
721 pptp_id_print(&ptr
->id
);
722 TCHECK(ptr
->result_code
);
723 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
724 TCHECK(ptr
->err_code
);
725 pptp_err_code_print(&ptr
->err_code
);
726 TCHECK(ptr
->reserved1
);
735 pptp_ocrq_print(const u_char
*dat
)
737 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
739 TCHECK(ptr
->call_id
);
740 pptp_call_id_print(&ptr
->call_id
);
741 TCHECK(ptr
->call_ser
);
742 pptp_call_ser_print(&ptr
->call_ser
);
743 TCHECK(ptr
->min_bps
);
744 printf(" MIN_BPS(%lu)", (unsigned long)ntohl(ptr
->min_bps
));
745 TCHECK(ptr
->max_bps
);
746 printf(" MAX_BPS(%lu)", (unsigned long)ntohl(ptr
->max_bps
));
747 TCHECK(ptr
->bearer_type
);
748 pptp_bearer_type_print(&ptr
->bearer_type
);
749 TCHECK(ptr
->framing_type
);
750 pptp_framing_type_print(&ptr
->framing_type
);
751 TCHECK(ptr
->recv_winsiz
);
752 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
753 TCHECK(ptr
->pkt_proc_delay
);
754 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
755 TCHECK(ptr
->phone_no_len
);
756 printf(" PHONE_NO_LEN(%u)", ntohs(ptr
->phone_no_len
));
757 TCHECK(ptr
->reserved1
);
758 TCHECK(ptr
->phone_no
);
759 printf(" PHONE_NO(%.64s)", ptr
->phone_no
);
760 TCHECK(ptr
->subaddr
);
761 pptp_subaddr_print(&ptr
->subaddr
[0]);
770 pptp_ocrp_print(const u_char
*dat
)
772 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
774 TCHECK(ptr
->call_id
);
775 pptp_call_id_print(&ptr
->call_id
);
776 TCHECK(ptr
->peer_call_id
);
777 pptp_peer_call_id_print(&ptr
->peer_call_id
);
778 TCHECK(ptr
->result_code
);
779 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
780 TCHECK(ptr
->err_code
);
781 pptp_err_code_print(&ptr
->err_code
);
782 TCHECK(ptr
->cause_code
);
783 pptp_cause_code_print(&ptr
->cause_code
);
784 TCHECK(ptr
->conn_speed
);
785 pptp_conn_speed_print(&ptr
->conn_speed
);
786 TCHECK(ptr
->recv_winsiz
);
787 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
788 TCHECK(ptr
->pkt_proc_delay
);
789 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
790 TCHECK(ptr
->phy_chan_id
);
791 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
800 pptp_icrq_print(const u_char
*dat
)
802 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
804 TCHECK(ptr
->call_id
);
805 pptp_call_id_print(&ptr
->call_id
);
806 TCHECK(ptr
->call_ser
);
807 pptp_call_ser_print(&ptr
->call_ser
);
808 TCHECK(ptr
->bearer_type
);
809 pptp_bearer_type_print(&ptr
->bearer_type
);
810 TCHECK(ptr
->phy_chan_id
);
811 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
812 TCHECK(ptr
->dialed_no_len
);
813 printf(" DIALED_NO_LEN(%u)", ntohs(ptr
->dialed_no_len
));
814 TCHECK(ptr
->dialing_no_len
);
815 printf(" DIALING_NO_LEN(%u)", ntohs(ptr
->dialing_no_len
));
816 TCHECK(ptr
->dialed_no
);
817 printf(" DIALED_NO(%.64s)", ptr
->dialed_no
);
818 TCHECK(ptr
->dialing_no
);
819 printf(" DIALING_NO(%.64s)", ptr
->dialing_no
);
820 TCHECK(ptr
->subaddr
);
821 pptp_subaddr_print(&ptr
->subaddr
[0]);
830 pptp_icrp_print(const u_char
*dat
)
832 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
834 TCHECK(ptr
->call_id
);
835 pptp_call_id_print(&ptr
->call_id
);
836 TCHECK(ptr
->peer_call_id
);
837 pptp_peer_call_id_print(&ptr
->peer_call_id
);
838 TCHECK(ptr
->result_code
);
839 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
840 TCHECK(ptr
->err_code
);
841 pptp_err_code_print(&ptr
->err_code
);
842 TCHECK(ptr
->recv_winsiz
);
843 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
844 TCHECK(ptr
->pkt_proc_delay
);
845 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
846 TCHECK(ptr
->reserved1
);
855 pptp_iccn_print(const u_char
*dat
)
857 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
859 TCHECK(ptr
->peer_call_id
);
860 pptp_peer_call_id_print(&ptr
->peer_call_id
);
861 TCHECK(ptr
->reserved1
);
862 TCHECK(ptr
->conn_speed
);
863 pptp_conn_speed_print(&ptr
->conn_speed
);
864 TCHECK(ptr
->recv_winsiz
);
865 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
866 TCHECK(ptr
->pkt_proc_delay
);
867 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
868 TCHECK(ptr
->framing_type
);
869 pptp_framing_type_print(&ptr
->framing_type
);
878 pptp_ccrq_print(const u_char
*dat
)
880 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
882 TCHECK(ptr
->call_id
);
883 pptp_call_id_print(&ptr
->call_id
);
884 TCHECK(ptr
->reserved1
);
893 pptp_cdn_print(const u_char
*dat
)
895 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
897 TCHECK(ptr
->call_id
);
898 pptp_call_id_print(&ptr
->call_id
);
899 TCHECK(ptr
->result_code
);
900 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
901 TCHECK(ptr
->err_code
);
902 pptp_err_code_print(&ptr
->err_code
);
903 TCHECK(ptr
->cause_code
);
904 pptp_cause_code_print(&ptr
->cause_code
);
905 TCHECK(ptr
->reserved1
);
906 TCHECK(ptr
->call_stats
);
907 printf(" CALL_STATS(%.128s)", ptr
->call_stats
);
916 pptp_wen_print(const u_char
*dat
)
918 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
920 TCHECK(ptr
->peer_call_id
);
921 pptp_peer_call_id_print(&ptr
->peer_call_id
);
922 TCHECK(ptr
->reserved1
);
923 TCHECK(ptr
->crc_err
);
924 printf(" CRC_ERR(%lu)", (unsigned long)ntohl(ptr
->crc_err
));
925 TCHECK(ptr
->framing_err
);
926 printf(" FRAMING_ERR(%lu)", (unsigned long)ntohl(ptr
->framing_err
));
927 TCHECK(ptr
->hardware_overrun
);
928 printf(" HARDWARE_OVERRUN(%lu)",
929 (unsigned long)ntohl(ptr
->hardware_overrun
));
930 TCHECK(ptr
->buffer_overrun
);
931 printf(" BUFFER_OVERRUN(%lu)",
932 (unsigned long)ntohl(ptr
->buffer_overrun
));
933 TCHECK(ptr
->timeout_err
);
934 printf(" TIMEOUT_ERR(%lu)", (unsigned long)ntohl(ptr
->timeout_err
));
935 TCHECK(ptr
->align_err
);
936 printf(" ALIGN_ERR(%lu)", (unsigned long)ntohl(ptr
->align_err
));
945 pptp_sli_print(const u_char
*dat
)
947 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
949 TCHECK(ptr
->peer_call_id
);
950 pptp_peer_call_id_print(&ptr
->peer_call_id
);
951 TCHECK(ptr
->reserved1
);
952 TCHECK(ptr
->send_accm
);
953 printf(" SEND_ACCM(0x%08lx)", (unsigned long)ntohl(ptr
->send_accm
));
954 TCHECK(ptr
->recv_accm
);
955 printf(" RECV_ACCM(0x%08lx)", (unsigned long)ntohl(ptr
->recv_accm
));
964 pptp_print(const u_char
*dat
, u_int length
)
966 const struct pptp_hdr
*hdr
;
968 u_int16_t ctrl_msg_type
;
972 hdr
= (struct pptp_hdr
*)dat
;
976 printf(" Length=%u", ntohs(hdr
->length
));
978 TCHECK(hdr
->msg_type
);
980 switch(ntohs(hdr
->msg_type
)) {
981 case PPTP_MSG_TYPE_CTRL
:
984 case PPTP_MSG_TYPE_MGMT
:
988 printf(" UNKNOWN-MSG-TYPE");
993 TCHECK(hdr
->magic_cookie
);
994 mc
= ntohl(hdr
->magic_cookie
);
995 if (mc
!= PPTP_MAGIC_COOKIE
) {
996 printf(" UNEXPECTED Magic-Cookie!!(%08x)", mc
);
998 if (vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
999 printf(" Magic-Cookie=%08x", mc
);
1001 TCHECK(hdr
->ctrl_msg_type
);
1002 ctrl_msg_type
= ntohs(hdr
->ctrl_msg_type
);
1003 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
1004 printf(" CTRL_MSGTYPE=%s",
1005 pptp_message_type_string
[ctrl_msg_type
]);
1007 printf(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
);
1009 TCHECK(hdr
->reserved0
);
1013 switch(ctrl_msg_type
) {
1014 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
1015 pptp_sccrq_print(dat
);
1017 case PPTP_CTRL_MSG_TYPE_SCCRP
:
1018 pptp_sccrp_print(dat
);
1020 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
1021 pptp_stopccrq_print(dat
);
1023 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
1024 pptp_stopccrp_print(dat
);
1026 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
1027 pptp_echorq_print(dat
);
1029 case PPTP_CTRL_MSG_TYPE_ECHORP
:
1030 pptp_echorp_print(dat
);
1032 case PPTP_CTRL_MSG_TYPE_OCRQ
:
1033 pptp_ocrq_print(dat
);
1035 case PPTP_CTRL_MSG_TYPE_OCRP
:
1036 pptp_ocrp_print(dat
);
1038 case PPTP_CTRL_MSG_TYPE_ICRQ
:
1039 pptp_icrq_print(dat
);
1041 case PPTP_CTRL_MSG_TYPE_ICRP
:
1042 pptp_icrp_print(dat
);
1044 case PPTP_CTRL_MSG_TYPE_ICCN
:
1045 pptp_iccn_print(dat
);
1047 case PPTP_CTRL_MSG_TYPE_CCRQ
:
1048 pptp_ccrq_print(dat
);
1050 case PPTP_CTRL_MSG_TYPE_CDN
:
1051 pptp_cdn_print(dat
);
1053 case PPTP_CTRL_MSG_TYPE_WEN
:
1054 pptp_wen_print(dat
);
1056 case PPTP_CTRL_MSG_TYPE_SLI
:
1057 pptp_sli_print(dat
);