2002-06-21 00:43:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that: (1) source code distributions
|
|
|
|
* retain the above copyright notice and this paragraph in its entirety, (2)
|
|
|
|
* distributions including binary code include the above copyright notice and
|
|
|
|
* this paragraph in its entirety in the documentation or other materials
|
|
|
|
* provided with the distribution, and (3) all advertising materials mentioning
|
|
|
|
* features or use of this software display the following acknowledgement:
|
|
|
|
* ``This product includes software developed by the University of California,
|
|
|
|
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
|
|
|
* the University nor the names of its contributors may be used to endorse
|
|
|
|
* or promote products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
|
|
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
* PPTP support contributed by Motonori Shindo (mshindo@mshindo.net)
|
|
|
|
*/
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
#define NETDISSECT_REWORKED
|
2002-06-21 00:43:23 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2004-03-31 09:17:26 +00:00
|
|
|
#include <tcpdump-stdinc.h>
|
|
|
|
|
2002-06-21 00:43:23 +00:00
|
|
|
#include "interface.h"
|
2004-03-31 09:17:26 +00:00
|
|
|
#include "extract.h"
|
2002-06-21 00:43:23 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
static const char tstr[] = " [|pptp]";
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
#define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
|
|
|
|
#define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
|
|
|
|
#define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
|
|
|
|
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_SCCRQ 1
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_SCCRP 2
|
2004-03-31 09:17:26 +00:00
|
|
|
#define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
|
2002-06-21 00:43:23 +00:00
|
|
|
#define PPTP_CTRL_MSG_TYPE_StopCCRP 4
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_ECHORQ 5
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_ECHORP 6
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_OCRQ 7
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_OCRP 8
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_ICRQ 9
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_ICRP 10
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_ICCN 11
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_CCRQ 12
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_CDN 13
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_WEN 14
|
|
|
|
#define PPTP_CTRL_MSG_TYPE_SLI 15
|
|
|
|
|
|
|
|
#define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
|
|
|
|
#define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
|
|
|
|
|
|
|
|
#define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
|
|
|
|
#define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
|
|
|
|
|
2004-03-31 09:17:26 +00:00
|
|
|
static const char *pptp_message_type_string[] = {
|
2002-06-21 00:43:23 +00:00
|
|
|
"NOT_DEFINED", /* 0 Not defined in the RFC2637 */
|
|
|
|
"SCCRQ", /* 1 Start-Control-Connection-Request */
|
|
|
|
"SCCRP", /* 2 Start-Control-Connection-Reply */
|
|
|
|
"StopCCRQ", /* 3 Stop-Control-Connection-Request */
|
|
|
|
"StopCCRP", /* 4 Stop-Control-Connection-Reply */
|
|
|
|
"ECHORQ", /* 5 Echo Request */
|
|
|
|
"ECHORP", /* 6 Echo Reply */
|
|
|
|
|
|
|
|
"OCRQ", /* 7 Outgoing-Call-Request */
|
|
|
|
"OCRP", /* 8 Outgoing-Call-Reply */
|
|
|
|
"ICRQ", /* 9 Incoming-Call-Request */
|
|
|
|
"ICRP", /* 10 Incoming-Call-Reply */
|
|
|
|
"ICCN", /* 11 Incoming-Call-Connected */
|
|
|
|
"CCRQ", /* 12 Call-Clear-Request */
|
|
|
|
"CDN", /* 13 Call-Disconnect-Notify */
|
|
|
|
|
|
|
|
"WEN", /* 14 WAN-Error-Notify */
|
|
|
|
|
|
|
|
"SLI" /* 15 Set-Link-Info */
|
|
|
|
#define PPTP_MAX_MSGTYPE_INDEX 16
|
|
|
|
};
|
|
|
|
|
|
|
|
/* common for all PPTP control messages */
|
|
|
|
struct pptp_hdr {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t length;
|
|
|
|
uint16_t msg_type;
|
|
|
|
uint32_t magic_cookie;
|
|
|
|
uint16_t ctrl_msg_type;
|
|
|
|
uint16_t reserved0;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_sccrq {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t proto_ver;
|
|
|
|
uint16_t reserved1;
|
|
|
|
uint32_t framing_cap;
|
|
|
|
uint32_t bearer_cap;
|
|
|
|
uint16_t max_channel;
|
|
|
|
uint16_t firm_rev;
|
2002-06-21 00:43:23 +00:00
|
|
|
u_char hostname[64];
|
|
|
|
u_char vendor[64];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_sccrp {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t proto_ver;
|
|
|
|
uint8_t result_code;
|
|
|
|
uint8_t err_code;
|
|
|
|
uint32_t framing_cap;
|
|
|
|
uint32_t bearer_cap;
|
|
|
|
uint16_t max_channel;
|
|
|
|
uint16_t firm_rev;
|
2002-06-21 00:43:23 +00:00
|
|
|
u_char hostname[64];
|
|
|
|
u_char vendor[64];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_stopccrq {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t reason;
|
|
|
|
uint8_t reserved1;
|
|
|
|
uint16_t reserved2;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_stopccrp {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t result_code;
|
|
|
|
uint8_t err_code;
|
|
|
|
uint16_t reserved1;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_echorq {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t id;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_echorp {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t id;
|
|
|
|
uint8_t result_code;
|
|
|
|
uint8_t err_code;
|
|
|
|
uint16_t reserved1;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_ocrq {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t call_id;
|
|
|
|
uint16_t call_ser;
|
|
|
|
uint32_t min_bps;
|
|
|
|
uint32_t max_bps;
|
|
|
|
uint32_t bearer_type;
|
|
|
|
uint32_t framing_type;
|
|
|
|
uint16_t recv_winsiz;
|
|
|
|
uint16_t pkt_proc_delay;
|
|
|
|
uint16_t phone_no_len;
|
|
|
|
uint16_t reserved1;
|
2002-06-21 00:43:23 +00:00
|
|
|
u_char phone_no[64];
|
|
|
|
u_char subaddr[64];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_ocrp {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t call_id;
|
|
|
|
uint16_t peer_call_id;
|
|
|
|
uint8_t result_code;
|
|
|
|
uint8_t err_code;
|
|
|
|
uint16_t cause_code;
|
|
|
|
uint32_t conn_speed;
|
|
|
|
uint16_t recv_winsiz;
|
|
|
|
uint16_t pkt_proc_delay;
|
|
|
|
uint32_t phy_chan_id;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_icrq {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t call_id;
|
|
|
|
uint16_t call_ser;
|
|
|
|
uint32_t bearer_type;
|
|
|
|
uint32_t phy_chan_id;
|
|
|
|
uint16_t dialed_no_len;
|
|
|
|
uint16_t dialing_no_len;
|
2002-06-21 00:43:23 +00:00
|
|
|
u_char dialed_no[64]; /* DNIS */
|
|
|
|
u_char dialing_no[64]; /* CLID */
|
|
|
|
u_char subaddr[64];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_icrp {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t call_id;
|
|
|
|
uint16_t peer_call_id;
|
|
|
|
uint8_t result_code;
|
|
|
|
uint8_t err_code;
|
|
|
|
uint16_t recv_winsiz;
|
|
|
|
uint16_t pkt_proc_delay;
|
|
|
|
uint16_t reserved1;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_iccn {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t peer_call_id;
|
|
|
|
uint16_t reserved1;
|
|
|
|
uint32_t conn_speed;
|
|
|
|
uint16_t recv_winsiz;
|
|
|
|
uint16_t pkt_proc_delay;
|
|
|
|
uint32_t framing_type;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_ccrq {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t call_id;
|
|
|
|
uint16_t reserved1;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_cdn {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t call_id;
|
|
|
|
uint8_t result_code;
|
|
|
|
uint8_t err_code;
|
|
|
|
uint16_t cause_code;
|
|
|
|
uint16_t reserved1;
|
2002-06-21 00:43:23 +00:00
|
|
|
u_char call_stats[128];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_wen {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t peer_call_id;
|
|
|
|
uint16_t reserved1;
|
|
|
|
uint32_t crc_err;
|
|
|
|
uint32_t framing_err;
|
|
|
|
uint32_t hardware_overrun;
|
|
|
|
uint32_t buffer_overrun;
|
|
|
|
uint32_t timeout_err;
|
|
|
|
uint32_t align_err;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pptp_msg_sli {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t peer_call_id;
|
|
|
|
uint16_t reserved1;
|
|
|
|
uint32_t send_accm;
|
|
|
|
uint32_t recv_accm;
|
2002-06-21 00:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* attributes that appear more than once in above messages:
|
|
|
|
|
2004-03-31 09:17:26 +00:00
|
|
|
Number of
|
2002-06-21 00:43:23 +00:00
|
|
|
occurence attributes
|
|
|
|
--------------------------------------
|
2015-01-06 19:03:11 +00:00
|
|
|
2 uint32_t bearer_cap;
|
|
|
|
2 uint32_t bearer_type;
|
|
|
|
6 uint16_t call_id;
|
|
|
|
2 uint16_t call_ser;
|
|
|
|
2 uint16_t cause_code;
|
|
|
|
2 uint32_t conn_speed;
|
|
|
|
6 uint8_t err_code;
|
|
|
|
2 uint16_t firm_rev;
|
|
|
|
2 uint32_t framing_cap;
|
|
|
|
2 uint32_t framing_type;
|
2002-06-21 00:43:23 +00:00
|
|
|
2 u_char hostname[64];
|
2015-01-06 19:03:11 +00:00
|
|
|
2 uint32_t id;
|
|
|
|
2 uint16_t max_channel;
|
|
|
|
5 uint16_t peer_call_id;
|
|
|
|
2 uint32_t phy_chan_id;
|
|
|
|
4 uint16_t pkt_proc_delay;
|
|
|
|
2 uint16_t proto_ver;
|
|
|
|
4 uint16_t recv_winsiz;
|
|
|
|
2 uint8_t reserved1;
|
|
|
|
9 uint16_t reserved1;
|
|
|
|
6 uint8_t result_code;
|
2002-06-21 00:43:23 +00:00
|
|
|
2 u_char subaddr[64];
|
|
|
|
2 u_char vendor[64];
|
|
|
|
|
2004-03-31 09:17:26 +00:00
|
|
|
so I will prepare print out functions for these attributes (except for
|
2002-06-21 00:43:23 +00:00
|
|
|
reserved*).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/******************************************/
|
|
|
|
/* Attribute-specific print out functions */
|
|
|
|
/******************************************/
|
|
|
|
|
|
|
|
/* In these attribute-specific print-out functions, it't not necessary
|
2015-01-06 19:03:11 +00:00
|
|
|
to do ND_TCHECK because they are already checked in the caller of
|
2002-06-21 00:43:23 +00:00
|
|
|
these functions. */
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_bearer_cap_print(netdissect_options *ndo,
|
|
|
|
const uint32_t *bearer_cap)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " BEARER_CAP(%s%s)",
|
|
|
|
EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "",
|
|
|
|
EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
static const struct tok pptp_btype_str[] = {
|
|
|
|
{ 1, "A" }, /* Analog */
|
|
|
|
{ 2, "D" }, /* Digital */
|
|
|
|
{ 3, "Any" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2002-06-21 00:43:23 +00:00
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_bearer_type_print(netdissect_options *ndo,
|
|
|
|
const uint32_t *bearer_type)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " BEARER_TYPE(%s)",
|
|
|
|
tok2str(pptp_btype_str, "?", EXTRACT_32BITS(bearer_type))));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_call_id_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *call_id)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_16BITS(call_id)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_call_ser_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *call_ser)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_cause_code_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *cause_code)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_conn_speed_print(netdissect_options *ndo,
|
|
|
|
const uint32_t *conn_speed)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
static const struct tok pptp_errcode_str[] = {
|
|
|
|
{ 0, "None" },
|
|
|
|
{ 1, "Not-Connected" },
|
|
|
|
{ 2, "Bad-Format" },
|
|
|
|
{ 3, "Bad-Value" },
|
|
|
|
{ 4, "No-Resource" },
|
|
|
|
{ 5, "Bad-Call-ID" },
|
|
|
|
{ 6, "PAC-Error" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2002-06-21 00:43:23 +00:00
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_err_code_print(netdissect_options *ndo,
|
|
|
|
const uint8_t *err_code)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " ERR_CODE(%u", *err_code));
|
|
|
|
if (ndo->ndo_vflag) {
|
|
|
|
ND_PRINT((ndo, ":%s", tok2str(pptp_errcode_str, "?", *err_code)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ")"));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_firm_rev_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *firm_rev)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_framing_cap_print(netdissect_options *ndo,
|
|
|
|
const uint32_t *framing_cap)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " FRAME_CAP("));
|
2004-03-31 09:17:26 +00:00
|
|
|
if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "A")); /* Async */
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
2004-03-31 09:17:26 +00:00
|
|
|
if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "S")); /* Sync */
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ")"));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
static const struct tok pptp_ftype_str[] = {
|
|
|
|
{ 1, "A" }, /* Async */
|
|
|
|
{ 2, "S" }, /* Sync */
|
|
|
|
{ 3, "E" }, /* Either */
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2002-06-21 00:43:23 +00:00
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_framing_type_print(netdissect_options *ndo,
|
|
|
|
const uint32_t *framing_type)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " FRAME_TYPE(%s)",
|
|
|
|
tok2str(pptp_ftype_str, "?", EXTRACT_32BITS(framing_type))));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_hostname_print(netdissect_options *ndo,
|
|
|
|
const u_char *hostname)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " HOSTNAME(%.64s)", hostname));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_id_print(netdissect_options *ndo,
|
|
|
|
const uint32_t *id)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " ID(%u)", EXTRACT_32BITS(id)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_max_channel_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *max_channel)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_peer_call_id_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *peer_call_id)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_phy_chan_id_print(netdissect_options *ndo,
|
|
|
|
const uint32_t *phy_chan_id)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_pkt_proc_delay_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *pkt_proc_delay)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_proto_ver_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *proto_ver)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " PROTO_VER(%u.%u)", /* Version.Revision */
|
2004-03-31 09:17:26 +00:00
|
|
|
EXTRACT_16BITS(proto_ver) >> 8,
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_16BITS(proto_ver) & 0xff));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_recv_winsiz_print(netdissect_options *ndo,
|
|
|
|
const uint16_t *recv_winsiz)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
static const struct tok pptp_scrrp_str[] = {
|
|
|
|
{ 1, "Successful channel establishment" },
|
|
|
|
{ 2, "General error" },
|
|
|
|
{ 3, "Command channel already exists" },
|
|
|
|
{ 4, "Requester is not authorized to establish a command channel" },
|
|
|
|
{ 5, "The protocol version of the requester is not supported" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct tok pptp_echorp_str[] = {
|
|
|
|
{ 1, "OK" },
|
|
|
|
{ 2, "General Error" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct tok pptp_ocrp_str[] = {
|
|
|
|
{ 1, "Connected" },
|
|
|
|
{ 2, "General Error" },
|
|
|
|
{ 3, "No Carrier" },
|
|
|
|
{ 4, "Busy" },
|
|
|
|
{ 5, "No Dial Tone" },
|
|
|
|
{ 6, "Time-out" },
|
|
|
|
{ 7, "Do Not Accept" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct tok pptp_icrp_str[] = {
|
|
|
|
{ 1, "Connect" },
|
|
|
|
{ 2, "General Error" },
|
|
|
|
{ 3, "Do Not Accept" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct tok pptp_cdn_str[] = {
|
|
|
|
{ 1, "Lost Carrier" },
|
|
|
|
{ 2, "General Error" },
|
|
|
|
{ 3, "Admin Shutdown" },
|
|
|
|
{ 4, "Request" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2002-06-21 00:43:23 +00:00
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_result_code_print(netdissect_options *ndo,
|
|
|
|
const uint8_t *result_code, int ctrl_msg_type)
|
|
|
|
{
|
|
|
|
ND_PRINT((ndo, " RESULT_CODE(%u", *result_code));
|
|
|
|
if (ndo->ndo_vflag) {
|
|
|
|
const struct tok *dict =
|
|
|
|
ctrl_msg_type == PPTP_CTRL_MSG_TYPE_SCCRP ? pptp_scrrp_str :
|
|
|
|
ctrl_msg_type == PPTP_CTRL_MSG_TYPE_StopCCRP ? pptp_echorp_str :
|
|
|
|
ctrl_msg_type == PPTP_CTRL_MSG_TYPE_ECHORP ? pptp_echorp_str :
|
|
|
|
ctrl_msg_type == PPTP_CTRL_MSG_TYPE_OCRP ? pptp_ocrp_str :
|
|
|
|
ctrl_msg_type == PPTP_CTRL_MSG_TYPE_ICRP ? pptp_icrp_str :
|
|
|
|
ctrl_msg_type == PPTP_CTRL_MSG_TYPE_CDN ? pptp_cdn_str :
|
|
|
|
NULL; /* assertion error */
|
|
|
|
if (dict != NULL)
|
|
|
|
ND_PRINT((ndo, ":%s", tok2str(dict, "?", *result_code)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ")"));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_subaddr_print(netdissect_options *ndo,
|
|
|
|
const u_char *subaddr)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " SUB_ADDR(%.64s)", subaddr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_vendor_print(netdissect_options *ndo,
|
|
|
|
const u_char *vendor)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " VENDOR(%.64s)", vendor));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************/
|
|
|
|
/* PPTP message print out functions */
|
|
|
|
/************************************/
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_sccrq_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_sccrq *ptr = (struct pptp_msg_sccrq *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->proto_ver);
|
|
|
|
pptp_proto_ver_print(ndo, &ptr->proto_ver);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
|
|
|
ND_TCHECK(ptr->framing_cap);
|
|
|
|
pptp_framing_cap_print(ndo, &ptr->framing_cap);
|
|
|
|
ND_TCHECK(ptr->bearer_cap);
|
|
|
|
pptp_bearer_cap_print(ndo, &ptr->bearer_cap);
|
|
|
|
ND_TCHECK(ptr->max_channel);
|
|
|
|
pptp_max_channel_print(ndo, &ptr->max_channel);
|
|
|
|
ND_TCHECK(ptr->firm_rev);
|
|
|
|
pptp_firm_rev_print(ndo, &ptr->firm_rev);
|
|
|
|
ND_TCHECK(ptr->hostname);
|
|
|
|
pptp_hostname_print(ndo, &ptr->hostname[0]);
|
|
|
|
ND_TCHECK(ptr->vendor);
|
|
|
|
pptp_vendor_print(ndo, &ptr->vendor[0]);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_sccrp_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_sccrp *ptr = (struct pptp_msg_sccrp *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->proto_ver);
|
|
|
|
pptp_proto_ver_print(ndo, &ptr->proto_ver);
|
|
|
|
ND_TCHECK(ptr->result_code);
|
|
|
|
pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_SCCRP);
|
|
|
|
ND_TCHECK(ptr->err_code);
|
|
|
|
pptp_err_code_print(ndo, &ptr->err_code);
|
|
|
|
ND_TCHECK(ptr->framing_cap);
|
|
|
|
pptp_framing_cap_print(ndo, &ptr->framing_cap);
|
|
|
|
ND_TCHECK(ptr->bearer_cap);
|
|
|
|
pptp_bearer_cap_print(ndo, &ptr->bearer_cap);
|
|
|
|
ND_TCHECK(ptr->max_channel);
|
|
|
|
pptp_max_channel_print(ndo, &ptr->max_channel);
|
|
|
|
ND_TCHECK(ptr->firm_rev);
|
|
|
|
pptp_firm_rev_print(ndo, &ptr->firm_rev);
|
|
|
|
ND_TCHECK(ptr->hostname);
|
|
|
|
pptp_hostname_print(ndo, &ptr->hostname[0]);
|
|
|
|
ND_TCHECK(ptr->vendor);
|
|
|
|
pptp_vendor_print(ndo, &ptr->vendor[0]);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_stopccrq_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_stopccrq *ptr = (struct pptp_msg_stopccrq *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->reason);
|
|
|
|
ND_PRINT((ndo, " REASON(%u", ptr->reason));
|
|
|
|
if (ndo->ndo_vflag) {
|
2002-06-21 00:43:23 +00:00
|
|
|
switch (ptr->reason) {
|
|
|
|
case 1:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ":None"));
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ":Stop-Protocol"));
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ":Stop-Local-Shutdown"));
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
default:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ":?"));
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ")"));
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
|
|
|
ND_TCHECK(ptr->reserved2);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_stopccrp_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_stopccrp *ptr = (struct pptp_msg_stopccrp *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->result_code);
|
|
|
|
pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_StopCCRP);
|
|
|
|
ND_TCHECK(ptr->err_code);
|
|
|
|
pptp_err_code_print(ndo, &ptr->err_code);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_echorq_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_echorq *ptr = (struct pptp_msg_echorq *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->id);
|
|
|
|
pptp_id_print(ndo, &ptr->id);
|
2004-03-31 09:17:26 +00:00
|
|
|
|
2002-06-21 00:43:23 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_echorp_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_echorp *ptr = (struct pptp_msg_echorp *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->id);
|
|
|
|
pptp_id_print(ndo, &ptr->id);
|
|
|
|
ND_TCHECK(ptr->result_code);
|
|
|
|
pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_ECHORP);
|
|
|
|
ND_TCHECK(ptr->err_code);
|
|
|
|
pptp_err_code_print(ndo, &ptr->err_code);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
2004-03-31 09:17:26 +00:00
|
|
|
|
2002-06-21 00:43:23 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_ocrq_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_ocrq *ptr = (struct pptp_msg_ocrq *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->call_id);
|
|
|
|
pptp_call_id_print(ndo, &ptr->call_id);
|
|
|
|
ND_TCHECK(ptr->call_ser);
|
|
|
|
pptp_call_ser_print(ndo, &ptr->call_ser);
|
|
|
|
ND_TCHECK(ptr->min_bps);
|
|
|
|
ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_32BITS(&ptr->min_bps)));
|
|
|
|
ND_TCHECK(ptr->max_bps);
|
|
|
|
ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_32BITS(&ptr->max_bps)));
|
|
|
|
ND_TCHECK(ptr->bearer_type);
|
|
|
|
pptp_bearer_type_print(ndo, &ptr->bearer_type);
|
|
|
|
ND_TCHECK(ptr->framing_type);
|
|
|
|
pptp_framing_type_print(ndo, &ptr->framing_type);
|
|
|
|
ND_TCHECK(ptr->recv_winsiz);
|
|
|
|
pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz);
|
|
|
|
ND_TCHECK(ptr->pkt_proc_delay);
|
|
|
|
pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay);
|
|
|
|
ND_TCHECK(ptr->phone_no_len);
|
|
|
|
ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr->phone_no_len)));
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
|
|
|
ND_TCHECK(ptr->phone_no);
|
|
|
|
ND_PRINT((ndo, " PHONE_NO(%.64s)", ptr->phone_no));
|
|
|
|
ND_TCHECK(ptr->subaddr);
|
|
|
|
pptp_subaddr_print(ndo, &ptr->subaddr[0]);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_ocrp_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_ocrp *ptr = (struct pptp_msg_ocrp *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->call_id);
|
|
|
|
pptp_call_id_print(ndo, &ptr->call_id);
|
|
|
|
ND_TCHECK(ptr->peer_call_id);
|
|
|
|
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
|
|
|
|
ND_TCHECK(ptr->result_code);
|
|
|
|
pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_OCRP);
|
|
|
|
ND_TCHECK(ptr->err_code);
|
|
|
|
pptp_err_code_print(ndo, &ptr->err_code);
|
|
|
|
ND_TCHECK(ptr->cause_code);
|
|
|
|
pptp_cause_code_print(ndo, &ptr->cause_code);
|
|
|
|
ND_TCHECK(ptr->conn_speed);
|
|
|
|
pptp_conn_speed_print(ndo, &ptr->conn_speed);
|
|
|
|
ND_TCHECK(ptr->recv_winsiz);
|
|
|
|
pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz);
|
|
|
|
ND_TCHECK(ptr->pkt_proc_delay);
|
|
|
|
pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay);
|
|
|
|
ND_TCHECK(ptr->phy_chan_id);
|
|
|
|
pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_icrq_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_icrq *ptr = (struct pptp_msg_icrq *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->call_id);
|
|
|
|
pptp_call_id_print(ndo, &ptr->call_id);
|
|
|
|
ND_TCHECK(ptr->call_ser);
|
|
|
|
pptp_call_ser_print(ndo, &ptr->call_ser);
|
|
|
|
ND_TCHECK(ptr->bearer_type);
|
|
|
|
pptp_bearer_type_print(ndo, &ptr->bearer_type);
|
|
|
|
ND_TCHECK(ptr->phy_chan_id);
|
|
|
|
pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id);
|
|
|
|
ND_TCHECK(ptr->dialed_no_len);
|
|
|
|
ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr->dialed_no_len)));
|
|
|
|
ND_TCHECK(ptr->dialing_no_len);
|
|
|
|
ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr->dialing_no_len)));
|
|
|
|
ND_TCHECK(ptr->dialed_no);
|
|
|
|
ND_PRINT((ndo, " DIALED_NO(%.64s)", ptr->dialed_no));
|
|
|
|
ND_TCHECK(ptr->dialing_no);
|
|
|
|
ND_PRINT((ndo, " DIALING_NO(%.64s)", ptr->dialing_no));
|
|
|
|
ND_TCHECK(ptr->subaddr);
|
|
|
|
pptp_subaddr_print(ndo, &ptr->subaddr[0]);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_icrp_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_icrp *ptr = (struct pptp_msg_icrp *)dat;
|
2004-03-31 09:17:26 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->call_id);
|
|
|
|
pptp_call_id_print(ndo, &ptr->call_id);
|
|
|
|
ND_TCHECK(ptr->peer_call_id);
|
|
|
|
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
|
|
|
|
ND_TCHECK(ptr->result_code);
|
|
|
|
pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_ICRP);
|
|
|
|
ND_TCHECK(ptr->err_code);
|
|
|
|
pptp_err_code_print(ndo, &ptr->err_code);
|
|
|
|
ND_TCHECK(ptr->recv_winsiz);
|
|
|
|
pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz);
|
|
|
|
ND_TCHECK(ptr->pkt_proc_delay);
|
|
|
|
pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_iccn_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_iccn *ptr = (struct pptp_msg_iccn *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->peer_call_id);
|
|
|
|
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
|
|
|
ND_TCHECK(ptr->conn_speed);
|
|
|
|
pptp_conn_speed_print(ndo, &ptr->conn_speed);
|
|
|
|
ND_TCHECK(ptr->recv_winsiz);
|
|
|
|
pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz);
|
|
|
|
ND_TCHECK(ptr->pkt_proc_delay);
|
|
|
|
pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay);
|
|
|
|
ND_TCHECK(ptr->framing_type);
|
|
|
|
pptp_framing_type_print(ndo, &ptr->framing_type);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_ccrq_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_ccrq *ptr = (struct pptp_msg_ccrq *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->call_id);
|
|
|
|
pptp_call_id_print(ndo, &ptr->call_id);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_cdn_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_cdn *ptr = (struct pptp_msg_cdn *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->call_id);
|
|
|
|
pptp_call_id_print(ndo, &ptr->call_id);
|
|
|
|
ND_TCHECK(ptr->result_code);
|
|
|
|
pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_CDN);
|
|
|
|
ND_TCHECK(ptr->err_code);
|
|
|
|
pptp_err_code_print(ndo, &ptr->err_code);
|
|
|
|
ND_TCHECK(ptr->cause_code);
|
|
|
|
pptp_cause_code_print(ndo, &ptr->cause_code);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
|
|
|
ND_TCHECK(ptr->call_stats);
|
|
|
|
ND_PRINT((ndo, " CALL_STATS(%.128s)", ptr->call_stats));
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_wen_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_wen *ptr = (struct pptp_msg_wen *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->peer_call_id);
|
|
|
|
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
|
|
|
ND_TCHECK(ptr->crc_err);
|
|
|
|
ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_32BITS(&ptr->crc_err)));
|
|
|
|
ND_TCHECK(ptr->framing_err);
|
|
|
|
ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr->framing_err)));
|
|
|
|
ND_TCHECK(ptr->hardware_overrun);
|
|
|
|
ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr->hardware_overrun)));
|
|
|
|
ND_TCHECK(ptr->buffer_overrun);
|
|
|
|
ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr->buffer_overrun)));
|
|
|
|
ND_TCHECK(ptr->timeout_err);
|
|
|
|
ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr->timeout_err)));
|
|
|
|
ND_TCHECK(ptr->align_err);
|
|
|
|
ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr->align_err)));
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_sli_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
struct pptp_msg_sli *ptr = (struct pptp_msg_sli *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(ptr->peer_call_id);
|
|
|
|
pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
|
|
|
|
ND_TCHECK(ptr->reserved1);
|
|
|
|
ND_TCHECK(ptr->send_accm);
|
|
|
|
ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->send_accm)));
|
|
|
|
ND_TCHECK(ptr->recv_accm);
|
|
|
|
ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->recv_accm)));
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_print(netdissect_options *ndo,
|
|
|
|
const u_char *dat)
|
2002-06-21 00:43:23 +00:00
|
|
|
{
|
|
|
|
const struct pptp_hdr *hdr;
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t mc;
|
|
|
|
uint16_t ctrl_msg_type;
|
2002-06-21 00:43:23 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ": pptp"));
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
hdr = (struct pptp_hdr *)dat;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(hdr->length);
|
|
|
|
if (ndo->ndo_vflag) {
|
|
|
|
ND_PRINT((ndo, " Length=%u", EXTRACT_16BITS(&hdr->length)));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(hdr->msg_type);
|
|
|
|
if (ndo->ndo_vflag) {
|
2004-03-31 09:17:26 +00:00
|
|
|
switch(EXTRACT_16BITS(&hdr->msg_type)) {
|
2002-06-21 00:43:23 +00:00
|
|
|
case PPTP_MSG_TYPE_CTRL:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " CTRL-MSG"));
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_MSG_TYPE_MGMT:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " MGMT-MSG"));
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
default:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " UNKNOWN-MSG-TYPE"));
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(hdr->magic_cookie);
|
2004-03-31 09:17:26 +00:00
|
|
|
mc = EXTRACT_32BITS(&hdr->magic_cookie);
|
2002-06-21 00:43:23 +00:00
|
|
|
if (mc != PPTP_MAGIC_COOKIE) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " UNEXPECTED Magic-Cookie!!(%08x)", mc));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
if (ndo->ndo_vflag || mc != PPTP_MAGIC_COOKIE) {
|
|
|
|
ND_PRINT((ndo, " Magic-Cookie=%08x", mc));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(hdr->ctrl_msg_type);
|
2004-03-31 09:17:26 +00:00
|
|
|
ctrl_msg_type = EXTRACT_16BITS(&hdr->ctrl_msg_type);
|
2002-06-21 00:43:23 +00:00
|
|
|
if (ctrl_msg_type < PPTP_MAX_MSGTYPE_INDEX) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " CTRL_MSGTYPE=%s",
|
|
|
|
pptp_message_type_string[ctrl_msg_type]));
|
2002-06-21 00:43:23 +00:00
|
|
|
} else {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type));
|
2002-06-21 00:43:23 +00:00
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(hdr->reserved0);
|
2002-06-21 00:43:23 +00:00
|
|
|
|
|
|
|
dat += 12;
|
|
|
|
|
|
|
|
switch(ctrl_msg_type) {
|
|
|
|
case PPTP_CTRL_MSG_TYPE_SCCRQ:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_sccrq_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_SCCRP:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_sccrp_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_StopCCRQ:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_stopccrq_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_StopCCRP:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_stopccrp_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_ECHORQ:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_echorq_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_ECHORP:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_echorp_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_OCRQ:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_ocrq_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_OCRP:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_ocrp_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_ICRQ:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_icrq_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_ICRP:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_icrp_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_ICCN:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_iccn_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_CCRQ:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_ccrq_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_CDN:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_cdn_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_WEN:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_wen_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
case PPTP_CTRL_MSG_TYPE_SLI:
|
2015-01-06 19:03:11 +00:00
|
|
|
pptp_sli_print(ndo, dat);
|
2002-06-21 00:43:23 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* do nothing */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s", tstr));
|
2004-03-31 09:17:26 +00:00
|
|
|
}
|