The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997 |
| 3 | * The Regents of the University of California. All rights reserved. |
| 4 | * |
| 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 |
| 16 | * written permission. |
| 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. |
| 20 | * |
| 21 | * PPTP support contributed by Motonori Shindo (mshindo@mshindo.net) |
| 22 | */ |
| 23 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 24 | /* \summary: Point-to-Point Tunnelling Protocol (PPTP) printer */ |
| 25 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 26 | #ifdef HAVE_CONFIG_H |
| 27 | #include "config.h" |
| 28 | #endif |
| 29 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 30 | #include <netdissect-stdinc.h> |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 31 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 32 | #include "netdissect.h" |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 33 | #include "extract.h" |
| 34 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 35 | static const char tstr[] = " [|pptp]"; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 36 | |
| 37 | #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */ |
| 38 | #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */ |
| 39 | #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */ |
| 40 | |
| 41 | #define PPTP_CTRL_MSG_TYPE_SCCRQ 1 |
| 42 | #define PPTP_CTRL_MSG_TYPE_SCCRP 2 |
| 43 | #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3 |
| 44 | #define PPTP_CTRL_MSG_TYPE_StopCCRP 4 |
| 45 | #define PPTP_CTRL_MSG_TYPE_ECHORQ 5 |
| 46 | #define PPTP_CTRL_MSG_TYPE_ECHORP 6 |
| 47 | #define PPTP_CTRL_MSG_TYPE_OCRQ 7 |
| 48 | #define PPTP_CTRL_MSG_TYPE_OCRP 8 |
| 49 | #define PPTP_CTRL_MSG_TYPE_ICRQ 9 |
| 50 | #define PPTP_CTRL_MSG_TYPE_ICRP 10 |
| 51 | #define PPTP_CTRL_MSG_TYPE_ICCN 11 |
| 52 | #define PPTP_CTRL_MSG_TYPE_CCRQ 12 |
| 53 | #define PPTP_CTRL_MSG_TYPE_CDN 13 |
| 54 | #define PPTP_CTRL_MSG_TYPE_WEN 14 |
| 55 | #define PPTP_CTRL_MSG_TYPE_SLI 15 |
| 56 | |
| 57 | #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */ |
| 58 | #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */ |
| 59 | |
| 60 | #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */ |
| 61 | #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */ |
| 62 | |
| 63 | static const char *pptp_message_type_string[] = { |
| 64 | "NOT_DEFINED", /* 0 Not defined in the RFC2637 */ |
| 65 | "SCCRQ", /* 1 Start-Control-Connection-Request */ |
| 66 | "SCCRP", /* 2 Start-Control-Connection-Reply */ |
| 67 | "StopCCRQ", /* 3 Stop-Control-Connection-Request */ |
| 68 | "StopCCRP", /* 4 Stop-Control-Connection-Reply */ |
| 69 | "ECHORQ", /* 5 Echo Request */ |
| 70 | "ECHORP", /* 6 Echo Reply */ |
| 71 | |
| 72 | "OCRQ", /* 7 Outgoing-Call-Request */ |
| 73 | "OCRP", /* 8 Outgoing-Call-Reply */ |
| 74 | "ICRQ", /* 9 Incoming-Call-Request */ |
| 75 | "ICRP", /* 10 Incoming-Call-Reply */ |
| 76 | "ICCN", /* 11 Incoming-Call-Connected */ |
| 77 | "CCRQ", /* 12 Call-Clear-Request */ |
| 78 | "CDN", /* 13 Call-Disconnect-Notify */ |
| 79 | |
| 80 | "WEN", /* 14 WAN-Error-Notify */ |
| 81 | |
| 82 | "SLI" /* 15 Set-Link-Info */ |
| 83 | #define PPTP_MAX_MSGTYPE_INDEX 16 |
| 84 | }; |
| 85 | |
| 86 | /* common for all PPTP control messages */ |
| 87 | struct pptp_hdr { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 88 | uint16_t length; |
| 89 | uint16_t msg_type; |
| 90 | uint32_t magic_cookie; |
| 91 | uint16_t ctrl_msg_type; |
| 92 | uint16_t reserved0; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | struct pptp_msg_sccrq { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 96 | uint16_t proto_ver; |
| 97 | uint16_t reserved1; |
| 98 | uint32_t framing_cap; |
| 99 | uint32_t bearer_cap; |
| 100 | uint16_t max_channel; |
| 101 | uint16_t firm_rev; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 102 | u_char hostname[64]; |
| 103 | u_char vendor[64]; |
| 104 | }; |
| 105 | |
| 106 | struct pptp_msg_sccrp { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 107 | uint16_t proto_ver; |
| 108 | uint8_t result_code; |
| 109 | uint8_t err_code; |
| 110 | uint32_t framing_cap; |
| 111 | uint32_t bearer_cap; |
| 112 | uint16_t max_channel; |
| 113 | uint16_t firm_rev; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 114 | u_char hostname[64]; |
| 115 | u_char vendor[64]; |
| 116 | }; |
| 117 | |
| 118 | struct pptp_msg_stopccrq { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 119 | uint8_t reason; |
| 120 | uint8_t reserved1; |
| 121 | uint16_t reserved2; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 122 | }; |
| 123 | |
| 124 | struct pptp_msg_stopccrp { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 125 | uint8_t result_code; |
| 126 | uint8_t err_code; |
| 127 | uint16_t reserved1; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 128 | }; |
| 129 | |
| 130 | struct pptp_msg_echorq { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 131 | uint32_t id; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | struct pptp_msg_echorp { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 135 | uint32_t id; |
| 136 | uint8_t result_code; |
| 137 | uint8_t err_code; |
| 138 | uint16_t reserved1; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 139 | }; |
| 140 | |
| 141 | struct pptp_msg_ocrq { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 142 | uint16_t call_id; |
| 143 | uint16_t call_ser; |
| 144 | uint32_t min_bps; |
| 145 | uint32_t max_bps; |
| 146 | uint32_t bearer_type; |
| 147 | uint32_t framing_type; |
| 148 | uint16_t recv_winsiz; |
| 149 | uint16_t pkt_proc_delay; |
| 150 | uint16_t phone_no_len; |
| 151 | uint16_t reserved1; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 152 | u_char phone_no[64]; |
| 153 | u_char subaddr[64]; |
| 154 | }; |
| 155 | |
| 156 | struct pptp_msg_ocrp { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 157 | uint16_t call_id; |
| 158 | uint16_t peer_call_id; |
| 159 | uint8_t result_code; |
| 160 | uint8_t err_code; |
| 161 | uint16_t cause_code; |
| 162 | uint32_t conn_speed; |
| 163 | uint16_t recv_winsiz; |
| 164 | uint16_t pkt_proc_delay; |
| 165 | uint32_t phy_chan_id; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 166 | }; |
| 167 | |
| 168 | struct pptp_msg_icrq { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 169 | uint16_t call_id; |
| 170 | uint16_t call_ser; |
| 171 | uint32_t bearer_type; |
| 172 | uint32_t phy_chan_id; |
| 173 | uint16_t dialed_no_len; |
| 174 | uint16_t dialing_no_len; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 175 | u_char dialed_no[64]; /* DNIS */ |
| 176 | u_char dialing_no[64]; /* CLID */ |
| 177 | u_char subaddr[64]; |
| 178 | }; |
| 179 | |
| 180 | struct pptp_msg_icrp { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 181 | uint16_t call_id; |
| 182 | uint16_t peer_call_id; |
| 183 | uint8_t result_code; |
| 184 | uint8_t err_code; |
| 185 | uint16_t recv_winsiz; |
| 186 | uint16_t pkt_proc_delay; |
| 187 | uint16_t reserved1; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 188 | }; |
| 189 | |
| 190 | struct pptp_msg_iccn { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 191 | uint16_t peer_call_id; |
| 192 | uint16_t reserved1; |
| 193 | uint32_t conn_speed; |
| 194 | uint16_t recv_winsiz; |
| 195 | uint16_t pkt_proc_delay; |
| 196 | uint32_t framing_type; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 197 | }; |
| 198 | |
| 199 | struct pptp_msg_ccrq { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 200 | uint16_t call_id; |
| 201 | uint16_t reserved1; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 202 | }; |
| 203 | |
| 204 | struct pptp_msg_cdn { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 205 | uint16_t call_id; |
| 206 | uint8_t result_code; |
| 207 | uint8_t err_code; |
| 208 | uint16_t cause_code; |
| 209 | uint16_t reserved1; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 210 | u_char call_stats[128]; |
| 211 | }; |
| 212 | |
| 213 | struct pptp_msg_wen { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 214 | uint16_t peer_call_id; |
| 215 | uint16_t reserved1; |
| 216 | uint32_t crc_err; |
| 217 | uint32_t framing_err; |
| 218 | uint32_t hardware_overrun; |
| 219 | uint32_t buffer_overrun; |
| 220 | uint32_t timeout_err; |
| 221 | uint32_t align_err; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 222 | }; |
| 223 | |
| 224 | struct pptp_msg_sli { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 225 | uint16_t peer_call_id; |
| 226 | uint16_t reserved1; |
| 227 | uint32_t send_accm; |
| 228 | uint32_t recv_accm; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 229 | }; |
| 230 | |
| 231 | /* attributes that appear more than once in above messages: |
| 232 | |
| 233 | Number of |
| 234 | occurence attributes |
| 235 | -------------------------------------- |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 236 | 2 uint32_t bearer_cap; |
| 237 | 2 uint32_t bearer_type; |
| 238 | 6 uint16_t call_id; |
| 239 | 2 uint16_t call_ser; |
| 240 | 2 uint16_t cause_code; |
| 241 | 2 uint32_t conn_speed; |
| 242 | 6 uint8_t err_code; |
| 243 | 2 uint16_t firm_rev; |
| 244 | 2 uint32_t framing_cap; |
| 245 | 2 uint32_t framing_type; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 246 | 2 u_char hostname[64]; |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 247 | 2 uint32_t id; |
| 248 | 2 uint16_t max_channel; |
| 249 | 5 uint16_t peer_call_id; |
| 250 | 2 uint32_t phy_chan_id; |
| 251 | 4 uint16_t pkt_proc_delay; |
| 252 | 2 uint16_t proto_ver; |
| 253 | 4 uint16_t recv_winsiz; |
| 254 | 2 uint8_t reserved1; |
| 255 | 9 uint16_t reserved1; |
| 256 | 6 uint8_t result_code; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 257 | 2 u_char subaddr[64]; |
| 258 | 2 u_char vendor[64]; |
| 259 | |
| 260 | so I will prepare print out functions for these attributes (except for |
| 261 | reserved*). |
| 262 | */ |
| 263 | |
| 264 | /******************************************/ |
| 265 | /* Attribute-specific print out functions */ |
| 266 | /******************************************/ |
| 267 | |
| 268 | /* In these attribute-specific print-out functions, it't not necessary |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 269 | to do ND_TCHECK because they are already checked in the caller of |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 270 | these functions. */ |
| 271 | |
| 272 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 273 | pptp_bearer_cap_print(netdissect_options *ndo, |
| 274 | const uint32_t *bearer_cap) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 275 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 276 | ND_PRINT((ndo, " BEARER_CAP(%s%s)", |
| 277 | EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", |
| 278 | EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : "")); |
| 279 | } |
| 280 | |
| 281 | static const struct tok pptp_btype_str[] = { |
| 282 | { 1, "A" }, /* Analog */ |
| 283 | { 2, "D" }, /* Digital */ |
| 284 | { 3, "Any" }, |
| 285 | { 0, NULL } |
| 286 | }; |
| 287 | |
| 288 | static void |
| 289 | pptp_bearer_type_print(netdissect_options *ndo, |
| 290 | const uint32_t *bearer_type) |
| 291 | { |
| 292 | ND_PRINT((ndo, " BEARER_TYPE(%s)", |
| 293 | tok2str(pptp_btype_str, "?", EXTRACT_32BITS(bearer_type)))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 297 | pptp_call_id_print(netdissect_options *ndo, |
| 298 | const uint16_t *call_id) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 299 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 300 | ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_16BITS(call_id))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 304 | pptp_call_ser_print(netdissect_options *ndo, |
| 305 | const uint16_t *call_ser) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 306 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 307 | ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 311 | pptp_cause_code_print(netdissect_options *ndo, |
| 312 | const uint16_t *cause_code) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 313 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 314 | ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 318 | pptp_conn_speed_print(netdissect_options *ndo, |
| 319 | const uint32_t *conn_speed) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 320 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 321 | ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 322 | } |
| 323 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 324 | static const struct tok pptp_errcode_str[] = { |
| 325 | { 0, "None" }, |
| 326 | { 1, "Not-Connected" }, |
| 327 | { 2, "Bad-Format" }, |
| 328 | { 3, "Bad-Value" }, |
| 329 | { 4, "No-Resource" }, |
| 330 | { 5, "Bad-Call-ID" }, |
| 331 | { 6, "PAC-Error" }, |
| 332 | { 0, NULL } |
| 333 | }; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 334 | |
| 335 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 336 | pptp_err_code_print(netdissect_options *ndo, |
| 337 | const uint8_t *err_code) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 338 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 339 | ND_PRINT((ndo, " ERR_CODE(%u", *err_code)); |
| 340 | if (ndo->ndo_vflag) { |
| 341 | ND_PRINT((ndo, ":%s", tok2str(pptp_errcode_str, "?", *err_code))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 342 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 343 | ND_PRINT((ndo, ")")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 344 | } |
| 345 | |
| 346 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 347 | pptp_firm_rev_print(netdissect_options *ndo, |
| 348 | const uint16_t *firm_rev) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 349 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 350 | ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 354 | pptp_framing_cap_print(netdissect_options *ndo, |
| 355 | const uint32_t *framing_cap) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 356 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 357 | ND_PRINT((ndo, " FRAME_CAP(")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 358 | if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 359 | ND_PRINT((ndo, "A")); /* Async */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 360 | } |
| 361 | if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 362 | ND_PRINT((ndo, "S")); /* Sync */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 363 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 364 | ND_PRINT((ndo, ")")); |
| 365 | } |
| 366 | |
| 367 | static const struct tok pptp_ftype_str[] = { |
| 368 | { 1, "A" }, /* Async */ |
| 369 | { 2, "S" }, /* Sync */ |
| 370 | { 3, "E" }, /* Either */ |
| 371 | { 0, NULL } |
| 372 | }; |
| 373 | |
| 374 | static void |
| 375 | pptp_framing_type_print(netdissect_options *ndo, |
| 376 | const uint32_t *framing_type) |
| 377 | { |
| 378 | ND_PRINT((ndo, " FRAME_TYPE(%s)", |
| 379 | tok2str(pptp_ftype_str, "?", EXTRACT_32BITS(framing_type)))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 383 | pptp_hostname_print(netdissect_options *ndo, |
| 384 | const u_char *hostname) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 385 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 386 | ND_PRINT((ndo, " HOSTNAME(%.64s)", hostname)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 390 | pptp_id_print(netdissect_options *ndo, |
| 391 | const uint32_t *id) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 392 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 393 | ND_PRINT((ndo, " ID(%u)", EXTRACT_32BITS(id))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 397 | pptp_max_channel_print(netdissect_options *ndo, |
| 398 | const uint16_t *max_channel) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 399 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 400 | ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 401 | } |
| 402 | |
| 403 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 404 | pptp_peer_call_id_print(netdissect_options *ndo, |
| 405 | const uint16_t *peer_call_id) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 406 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 407 | ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 411 | pptp_phy_chan_id_print(netdissect_options *ndo, |
| 412 | const uint32_t *phy_chan_id) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 413 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 414 | ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 418 | pptp_pkt_proc_delay_print(netdissect_options *ndo, |
| 419 | const uint16_t *pkt_proc_delay) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 420 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 421 | ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 425 | pptp_proto_ver_print(netdissect_options *ndo, |
| 426 | const uint16_t *proto_ver) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 427 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 428 | ND_PRINT((ndo, " PROTO_VER(%u.%u)", /* Version.Revision */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 429 | EXTRACT_16BITS(proto_ver) >> 8, |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 430 | EXTRACT_16BITS(proto_ver) & 0xff)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 431 | } |
| 432 | |
| 433 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 434 | pptp_recv_winsiz_print(netdissect_options *ndo, |
| 435 | const uint16_t *recv_winsiz) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 436 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 437 | ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 438 | } |
| 439 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 440 | static const struct tok pptp_scrrp_str[] = { |
| 441 | { 1, "Successful channel establishment" }, |
| 442 | { 2, "General error" }, |
| 443 | { 3, "Command channel already exists" }, |
| 444 | { 4, "Requester is not authorized to establish a command channel" }, |
| 445 | { 5, "The protocol version of the requester is not supported" }, |
| 446 | { 0, NULL } |
| 447 | }; |
| 448 | |
| 449 | static const struct tok pptp_echorp_str[] = { |
| 450 | { 1, "OK" }, |
| 451 | { 2, "General Error" }, |
| 452 | { 0, NULL } |
| 453 | }; |
| 454 | |
| 455 | static const struct tok pptp_ocrp_str[] = { |
| 456 | { 1, "Connected" }, |
| 457 | { 2, "General Error" }, |
| 458 | { 3, "No Carrier" }, |
| 459 | { 4, "Busy" }, |
| 460 | { 5, "No Dial Tone" }, |
| 461 | { 6, "Time-out" }, |
| 462 | { 7, "Do Not Accept" }, |
| 463 | { 0, NULL } |
| 464 | }; |
| 465 | |
| 466 | static const struct tok pptp_icrp_str[] = { |
| 467 | { 1, "Connect" }, |
| 468 | { 2, "General Error" }, |
| 469 | { 3, "Do Not Accept" }, |
| 470 | { 0, NULL } |
| 471 | }; |
| 472 | |
| 473 | static const struct tok pptp_cdn_str[] = { |
| 474 | { 1, "Lost Carrier" }, |
| 475 | { 2, "General Error" }, |
| 476 | { 3, "Admin Shutdown" }, |
| 477 | { 4, "Request" }, |
| 478 | { 0, NULL } |
| 479 | }; |
| 480 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 481 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 482 | pptp_result_code_print(netdissect_options *ndo, |
| 483 | const uint8_t *result_code, int ctrl_msg_type) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 484 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 485 | ND_PRINT((ndo, " RESULT_CODE(%u", *result_code)); |
| 486 | if (ndo->ndo_vflag) { |
| 487 | const struct tok *dict = |
| 488 | ctrl_msg_type == PPTP_CTRL_MSG_TYPE_SCCRP ? pptp_scrrp_str : |
| 489 | ctrl_msg_type == PPTP_CTRL_MSG_TYPE_StopCCRP ? pptp_echorp_str : |
| 490 | ctrl_msg_type == PPTP_CTRL_MSG_TYPE_ECHORP ? pptp_echorp_str : |
| 491 | ctrl_msg_type == PPTP_CTRL_MSG_TYPE_OCRP ? pptp_ocrp_str : |
| 492 | ctrl_msg_type == PPTP_CTRL_MSG_TYPE_ICRP ? pptp_icrp_str : |
| 493 | ctrl_msg_type == PPTP_CTRL_MSG_TYPE_CDN ? pptp_cdn_str : |
| 494 | NULL; /* assertion error */ |
| 495 | if (dict != NULL) |
| 496 | ND_PRINT((ndo, ":%s", tok2str(dict, "?", *result_code))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 497 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 498 | ND_PRINT((ndo, ")")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 502 | pptp_subaddr_print(netdissect_options *ndo, |
| 503 | const u_char *subaddr) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 504 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 505 | ND_PRINT((ndo, " SUB_ADDR(%.64s)", subaddr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 509 | pptp_vendor_print(netdissect_options *ndo, |
| 510 | const u_char *vendor) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 511 | { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 512 | ND_PRINT((ndo, " VENDOR(%.64s)", vendor)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 513 | } |
| 514 | |
| 515 | /************************************/ |
| 516 | /* PPTP message print out functions */ |
| 517 | /************************************/ |
| 518 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 519 | pptp_sccrq_print(netdissect_options *ndo, |
| 520 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 521 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 522 | const struct pptp_msg_sccrq *ptr = (const struct pptp_msg_sccrq *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 523 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 524 | ND_TCHECK(ptr->proto_ver); |
| 525 | pptp_proto_ver_print(ndo, &ptr->proto_ver); |
| 526 | ND_TCHECK(ptr->reserved1); |
| 527 | ND_TCHECK(ptr->framing_cap); |
| 528 | pptp_framing_cap_print(ndo, &ptr->framing_cap); |
| 529 | ND_TCHECK(ptr->bearer_cap); |
| 530 | pptp_bearer_cap_print(ndo, &ptr->bearer_cap); |
| 531 | ND_TCHECK(ptr->max_channel); |
| 532 | pptp_max_channel_print(ndo, &ptr->max_channel); |
| 533 | ND_TCHECK(ptr->firm_rev); |
| 534 | pptp_firm_rev_print(ndo, &ptr->firm_rev); |
| 535 | ND_TCHECK(ptr->hostname); |
| 536 | pptp_hostname_print(ndo, &ptr->hostname[0]); |
| 537 | ND_TCHECK(ptr->vendor); |
| 538 | pptp_vendor_print(ndo, &ptr->vendor[0]); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 539 | |
| 540 | return; |
| 541 | |
| 542 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 543 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 547 | pptp_sccrp_print(netdissect_options *ndo, |
| 548 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 549 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 550 | const struct pptp_msg_sccrp *ptr = (const struct pptp_msg_sccrp *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 551 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 552 | ND_TCHECK(ptr->proto_ver); |
| 553 | pptp_proto_ver_print(ndo, &ptr->proto_ver); |
| 554 | ND_TCHECK(ptr->result_code); |
| 555 | pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_SCCRP); |
| 556 | ND_TCHECK(ptr->err_code); |
| 557 | pptp_err_code_print(ndo, &ptr->err_code); |
| 558 | ND_TCHECK(ptr->framing_cap); |
| 559 | pptp_framing_cap_print(ndo, &ptr->framing_cap); |
| 560 | ND_TCHECK(ptr->bearer_cap); |
| 561 | pptp_bearer_cap_print(ndo, &ptr->bearer_cap); |
| 562 | ND_TCHECK(ptr->max_channel); |
| 563 | pptp_max_channel_print(ndo, &ptr->max_channel); |
| 564 | ND_TCHECK(ptr->firm_rev); |
| 565 | pptp_firm_rev_print(ndo, &ptr->firm_rev); |
| 566 | ND_TCHECK(ptr->hostname); |
| 567 | pptp_hostname_print(ndo, &ptr->hostname[0]); |
| 568 | ND_TCHECK(ptr->vendor); |
| 569 | pptp_vendor_print(ndo, &ptr->vendor[0]); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 570 | |
| 571 | return; |
| 572 | |
| 573 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 574 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 575 | } |
| 576 | |
| 577 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 578 | pptp_stopccrq_print(netdissect_options *ndo, |
| 579 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 580 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 581 | const struct pptp_msg_stopccrq *ptr = (const struct pptp_msg_stopccrq *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 582 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 583 | ND_TCHECK(ptr->reason); |
| 584 | ND_PRINT((ndo, " REASON(%u", ptr->reason)); |
| 585 | if (ndo->ndo_vflag) { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 586 | switch (ptr->reason) { |
| 587 | case 1: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 588 | ND_PRINT((ndo, ":None")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 589 | break; |
| 590 | case 2: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 591 | ND_PRINT((ndo, ":Stop-Protocol")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 592 | break; |
| 593 | case 3: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 594 | ND_PRINT((ndo, ":Stop-Local-Shutdown")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 595 | break; |
| 596 | default: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 597 | ND_PRINT((ndo, ":?")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 598 | break; |
| 599 | } |
| 600 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 601 | ND_PRINT((ndo, ")")); |
| 602 | ND_TCHECK(ptr->reserved1); |
| 603 | ND_TCHECK(ptr->reserved2); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 604 | |
| 605 | return; |
| 606 | |
| 607 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 608 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 609 | } |
| 610 | |
| 611 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 612 | pptp_stopccrp_print(netdissect_options *ndo, |
| 613 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 614 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 615 | const struct pptp_msg_stopccrp *ptr = (const struct pptp_msg_stopccrp *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 616 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 617 | ND_TCHECK(ptr->result_code); |
| 618 | pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_StopCCRP); |
| 619 | ND_TCHECK(ptr->err_code); |
| 620 | pptp_err_code_print(ndo, &ptr->err_code); |
| 621 | ND_TCHECK(ptr->reserved1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 622 | |
| 623 | return; |
| 624 | |
| 625 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 626 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 627 | } |
| 628 | |
| 629 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 630 | pptp_echorq_print(netdissect_options *ndo, |
| 631 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 632 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 633 | const struct pptp_msg_echorq *ptr = (const struct pptp_msg_echorq *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 634 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 635 | ND_TCHECK(ptr->id); |
| 636 | pptp_id_print(ndo, &ptr->id); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 637 | |
| 638 | return; |
| 639 | |
| 640 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 641 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 642 | } |
| 643 | |
| 644 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 645 | pptp_echorp_print(netdissect_options *ndo, |
| 646 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 647 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 648 | const struct pptp_msg_echorp *ptr = (const struct pptp_msg_echorp *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 649 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 650 | ND_TCHECK(ptr->id); |
| 651 | pptp_id_print(ndo, &ptr->id); |
| 652 | ND_TCHECK(ptr->result_code); |
| 653 | pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_ECHORP); |
| 654 | ND_TCHECK(ptr->err_code); |
| 655 | pptp_err_code_print(ndo, &ptr->err_code); |
| 656 | ND_TCHECK(ptr->reserved1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 657 | |
| 658 | return; |
| 659 | |
| 660 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 661 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 662 | } |
| 663 | |
| 664 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 665 | pptp_ocrq_print(netdissect_options *ndo, |
| 666 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 667 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 668 | const struct pptp_msg_ocrq *ptr = (const struct pptp_msg_ocrq *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 669 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 670 | ND_TCHECK(ptr->call_id); |
| 671 | pptp_call_id_print(ndo, &ptr->call_id); |
| 672 | ND_TCHECK(ptr->call_ser); |
| 673 | pptp_call_ser_print(ndo, &ptr->call_ser); |
| 674 | ND_TCHECK(ptr->min_bps); |
| 675 | ND_PRINT((ndo, " MIN_BPS(%u)", EXTRACT_32BITS(&ptr->min_bps))); |
| 676 | ND_TCHECK(ptr->max_bps); |
| 677 | ND_PRINT((ndo, " MAX_BPS(%u)", EXTRACT_32BITS(&ptr->max_bps))); |
| 678 | ND_TCHECK(ptr->bearer_type); |
| 679 | pptp_bearer_type_print(ndo, &ptr->bearer_type); |
| 680 | ND_TCHECK(ptr->framing_type); |
| 681 | pptp_framing_type_print(ndo, &ptr->framing_type); |
| 682 | ND_TCHECK(ptr->recv_winsiz); |
| 683 | pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz); |
| 684 | ND_TCHECK(ptr->pkt_proc_delay); |
| 685 | pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay); |
| 686 | ND_TCHECK(ptr->phone_no_len); |
| 687 | ND_PRINT((ndo, " PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr->phone_no_len))); |
| 688 | ND_TCHECK(ptr->reserved1); |
| 689 | ND_TCHECK(ptr->phone_no); |
| 690 | ND_PRINT((ndo, " PHONE_NO(%.64s)", ptr->phone_no)); |
| 691 | ND_TCHECK(ptr->subaddr); |
| 692 | pptp_subaddr_print(ndo, &ptr->subaddr[0]); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 693 | |
| 694 | return; |
| 695 | |
| 696 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 697 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 698 | } |
| 699 | |
| 700 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 701 | pptp_ocrp_print(netdissect_options *ndo, |
| 702 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 703 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 704 | const struct pptp_msg_ocrp *ptr = (const struct pptp_msg_ocrp *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 705 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 706 | ND_TCHECK(ptr->call_id); |
| 707 | pptp_call_id_print(ndo, &ptr->call_id); |
| 708 | ND_TCHECK(ptr->peer_call_id); |
| 709 | pptp_peer_call_id_print(ndo, &ptr->peer_call_id); |
| 710 | ND_TCHECK(ptr->result_code); |
| 711 | pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_OCRP); |
| 712 | ND_TCHECK(ptr->err_code); |
| 713 | pptp_err_code_print(ndo, &ptr->err_code); |
| 714 | ND_TCHECK(ptr->cause_code); |
| 715 | pptp_cause_code_print(ndo, &ptr->cause_code); |
| 716 | ND_TCHECK(ptr->conn_speed); |
| 717 | pptp_conn_speed_print(ndo, &ptr->conn_speed); |
| 718 | ND_TCHECK(ptr->recv_winsiz); |
| 719 | pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz); |
| 720 | ND_TCHECK(ptr->pkt_proc_delay); |
| 721 | pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay); |
| 722 | ND_TCHECK(ptr->phy_chan_id); |
| 723 | pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 724 | |
| 725 | return; |
| 726 | |
| 727 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 728 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 729 | } |
| 730 | |
| 731 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 732 | pptp_icrq_print(netdissect_options *ndo, |
| 733 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 734 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 735 | const struct pptp_msg_icrq *ptr = (const struct pptp_msg_icrq *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 736 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 737 | ND_TCHECK(ptr->call_id); |
| 738 | pptp_call_id_print(ndo, &ptr->call_id); |
| 739 | ND_TCHECK(ptr->call_ser); |
| 740 | pptp_call_ser_print(ndo, &ptr->call_ser); |
| 741 | ND_TCHECK(ptr->bearer_type); |
| 742 | pptp_bearer_type_print(ndo, &ptr->bearer_type); |
| 743 | ND_TCHECK(ptr->phy_chan_id); |
| 744 | pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id); |
| 745 | ND_TCHECK(ptr->dialed_no_len); |
| 746 | ND_PRINT((ndo, " DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr->dialed_no_len))); |
| 747 | ND_TCHECK(ptr->dialing_no_len); |
| 748 | ND_PRINT((ndo, " DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr->dialing_no_len))); |
| 749 | ND_TCHECK(ptr->dialed_no); |
| 750 | ND_PRINT((ndo, " DIALED_NO(%.64s)", ptr->dialed_no)); |
| 751 | ND_TCHECK(ptr->dialing_no); |
| 752 | ND_PRINT((ndo, " DIALING_NO(%.64s)", ptr->dialing_no)); |
| 753 | ND_TCHECK(ptr->subaddr); |
| 754 | pptp_subaddr_print(ndo, &ptr->subaddr[0]); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 755 | |
| 756 | return; |
| 757 | |
| 758 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 759 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 760 | } |
| 761 | |
| 762 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 763 | pptp_icrp_print(netdissect_options *ndo, |
| 764 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 765 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 766 | const struct pptp_msg_icrp *ptr = (const struct pptp_msg_icrp *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 767 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 768 | ND_TCHECK(ptr->call_id); |
| 769 | pptp_call_id_print(ndo, &ptr->call_id); |
| 770 | ND_TCHECK(ptr->peer_call_id); |
| 771 | pptp_peer_call_id_print(ndo, &ptr->peer_call_id); |
| 772 | ND_TCHECK(ptr->result_code); |
| 773 | pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_ICRP); |
| 774 | ND_TCHECK(ptr->err_code); |
| 775 | pptp_err_code_print(ndo, &ptr->err_code); |
| 776 | ND_TCHECK(ptr->recv_winsiz); |
| 777 | pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz); |
| 778 | ND_TCHECK(ptr->pkt_proc_delay); |
| 779 | pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay); |
| 780 | ND_TCHECK(ptr->reserved1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 781 | |
| 782 | return; |
| 783 | |
| 784 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 785 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 786 | } |
| 787 | |
| 788 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 789 | pptp_iccn_print(netdissect_options *ndo, |
| 790 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 791 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 792 | const struct pptp_msg_iccn *ptr = (const struct pptp_msg_iccn *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 793 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 794 | ND_TCHECK(ptr->peer_call_id); |
| 795 | pptp_peer_call_id_print(ndo, &ptr->peer_call_id); |
| 796 | ND_TCHECK(ptr->reserved1); |
| 797 | ND_TCHECK(ptr->conn_speed); |
| 798 | pptp_conn_speed_print(ndo, &ptr->conn_speed); |
| 799 | ND_TCHECK(ptr->recv_winsiz); |
| 800 | pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz); |
| 801 | ND_TCHECK(ptr->pkt_proc_delay); |
| 802 | pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay); |
| 803 | ND_TCHECK(ptr->framing_type); |
| 804 | pptp_framing_type_print(ndo, &ptr->framing_type); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 805 | |
| 806 | return; |
| 807 | |
| 808 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 809 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 813 | pptp_ccrq_print(netdissect_options *ndo, |
| 814 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 815 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 816 | const struct pptp_msg_ccrq *ptr = (const struct pptp_msg_ccrq *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 817 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 818 | ND_TCHECK(ptr->call_id); |
| 819 | pptp_call_id_print(ndo, &ptr->call_id); |
| 820 | ND_TCHECK(ptr->reserved1); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 821 | |
| 822 | return; |
| 823 | |
| 824 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 825 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 826 | } |
| 827 | |
| 828 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 829 | pptp_cdn_print(netdissect_options *ndo, |
| 830 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 831 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 832 | const struct pptp_msg_cdn *ptr = (const struct pptp_msg_cdn *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 833 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 834 | ND_TCHECK(ptr->call_id); |
| 835 | pptp_call_id_print(ndo, &ptr->call_id); |
| 836 | ND_TCHECK(ptr->result_code); |
| 837 | pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_CDN); |
| 838 | ND_TCHECK(ptr->err_code); |
| 839 | pptp_err_code_print(ndo, &ptr->err_code); |
| 840 | ND_TCHECK(ptr->cause_code); |
| 841 | pptp_cause_code_print(ndo, &ptr->cause_code); |
| 842 | ND_TCHECK(ptr->reserved1); |
| 843 | ND_TCHECK(ptr->call_stats); |
| 844 | ND_PRINT((ndo, " CALL_STATS(%.128s)", ptr->call_stats)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 845 | |
| 846 | return; |
| 847 | |
| 848 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 849 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 850 | } |
| 851 | |
| 852 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 853 | pptp_wen_print(netdissect_options *ndo, |
| 854 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 855 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 856 | const struct pptp_msg_wen *ptr = (const struct pptp_msg_wen *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 857 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 858 | ND_TCHECK(ptr->peer_call_id); |
| 859 | pptp_peer_call_id_print(ndo, &ptr->peer_call_id); |
| 860 | ND_TCHECK(ptr->reserved1); |
| 861 | ND_TCHECK(ptr->crc_err); |
| 862 | ND_PRINT((ndo, " CRC_ERR(%u)", EXTRACT_32BITS(&ptr->crc_err))); |
| 863 | ND_TCHECK(ptr->framing_err); |
| 864 | ND_PRINT((ndo, " FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr->framing_err))); |
| 865 | ND_TCHECK(ptr->hardware_overrun); |
| 866 | ND_PRINT((ndo, " HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr->hardware_overrun))); |
| 867 | ND_TCHECK(ptr->buffer_overrun); |
| 868 | ND_PRINT((ndo, " BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr->buffer_overrun))); |
| 869 | ND_TCHECK(ptr->timeout_err); |
| 870 | ND_PRINT((ndo, " TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr->timeout_err))); |
| 871 | ND_TCHECK(ptr->align_err); |
| 872 | ND_PRINT((ndo, " ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr->align_err))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 873 | |
| 874 | return; |
| 875 | |
| 876 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 877 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 878 | } |
| 879 | |
| 880 | static void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 881 | pptp_sli_print(netdissect_options *ndo, |
| 882 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 883 | { |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 884 | const struct pptp_msg_sli *ptr = (const struct pptp_msg_sli *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 885 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 886 | ND_TCHECK(ptr->peer_call_id); |
| 887 | pptp_peer_call_id_print(ndo, &ptr->peer_call_id); |
| 888 | ND_TCHECK(ptr->reserved1); |
| 889 | ND_TCHECK(ptr->send_accm); |
| 890 | ND_PRINT((ndo, " SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->send_accm))); |
| 891 | ND_TCHECK(ptr->recv_accm); |
| 892 | ND_PRINT((ndo, " RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->recv_accm))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 893 | |
| 894 | return; |
| 895 | |
| 896 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 897 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 898 | } |
| 899 | |
| 900 | void |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 901 | pptp_print(netdissect_options *ndo, |
| 902 | const u_char *dat) |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 903 | { |
| 904 | const struct pptp_hdr *hdr; |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 905 | uint32_t mc; |
| 906 | uint16_t ctrl_msg_type; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 907 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 908 | ND_PRINT((ndo, ": pptp")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 909 | |
Elliott Hughes | e2e3bd1 | 2017-05-15 10:59:29 -0700 | [diff] [blame] | 910 | hdr = (const struct pptp_hdr *)dat; |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 911 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 912 | ND_TCHECK(hdr->length); |
| 913 | if (ndo->ndo_vflag) { |
| 914 | ND_PRINT((ndo, " Length=%u", EXTRACT_16BITS(&hdr->length))); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 915 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 916 | ND_TCHECK(hdr->msg_type); |
| 917 | if (ndo->ndo_vflag) { |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 918 | switch(EXTRACT_16BITS(&hdr->msg_type)) { |
| 919 | case PPTP_MSG_TYPE_CTRL: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 920 | ND_PRINT((ndo, " CTRL-MSG")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 921 | break; |
| 922 | case PPTP_MSG_TYPE_MGMT: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 923 | ND_PRINT((ndo, " MGMT-MSG")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 924 | break; |
| 925 | default: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 926 | ND_PRINT((ndo, " UNKNOWN-MSG-TYPE")); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 927 | break; |
| 928 | } |
| 929 | } |
| 930 | |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 931 | ND_TCHECK(hdr->magic_cookie); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 932 | mc = EXTRACT_32BITS(&hdr->magic_cookie); |
| 933 | if (mc != PPTP_MAGIC_COOKIE) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 934 | ND_PRINT((ndo, " UNEXPECTED Magic-Cookie!!(%08x)", mc)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 935 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 936 | if (ndo->ndo_vflag || mc != PPTP_MAGIC_COOKIE) { |
| 937 | ND_PRINT((ndo, " Magic-Cookie=%08x", mc)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 938 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 939 | ND_TCHECK(hdr->ctrl_msg_type); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 940 | ctrl_msg_type = EXTRACT_16BITS(&hdr->ctrl_msg_type); |
| 941 | if (ctrl_msg_type < PPTP_MAX_MSGTYPE_INDEX) { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 942 | ND_PRINT((ndo, " CTRL_MSGTYPE=%s", |
| 943 | pptp_message_type_string[ctrl_msg_type])); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 944 | } else { |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 945 | ND_PRINT((ndo, " UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 946 | } |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 947 | ND_TCHECK(hdr->reserved0); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 948 | |
| 949 | dat += 12; |
| 950 | |
| 951 | switch(ctrl_msg_type) { |
| 952 | case PPTP_CTRL_MSG_TYPE_SCCRQ: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 953 | pptp_sccrq_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 954 | break; |
| 955 | case PPTP_CTRL_MSG_TYPE_SCCRP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 956 | pptp_sccrp_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 957 | break; |
| 958 | case PPTP_CTRL_MSG_TYPE_StopCCRQ: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 959 | pptp_stopccrq_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 960 | break; |
| 961 | case PPTP_CTRL_MSG_TYPE_StopCCRP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 962 | pptp_stopccrp_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 963 | break; |
| 964 | case PPTP_CTRL_MSG_TYPE_ECHORQ: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 965 | pptp_echorq_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 966 | break; |
| 967 | case PPTP_CTRL_MSG_TYPE_ECHORP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 968 | pptp_echorp_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 969 | break; |
| 970 | case PPTP_CTRL_MSG_TYPE_OCRQ: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 971 | pptp_ocrq_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 972 | break; |
| 973 | case PPTP_CTRL_MSG_TYPE_OCRP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 974 | pptp_ocrp_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 975 | break; |
| 976 | case PPTP_CTRL_MSG_TYPE_ICRQ: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 977 | pptp_icrq_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 978 | break; |
| 979 | case PPTP_CTRL_MSG_TYPE_ICRP: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 980 | pptp_icrp_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 981 | break; |
| 982 | case PPTP_CTRL_MSG_TYPE_ICCN: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 983 | pptp_iccn_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 984 | break; |
| 985 | case PPTP_CTRL_MSG_TYPE_CCRQ: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 986 | pptp_ccrq_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 987 | break; |
| 988 | case PPTP_CTRL_MSG_TYPE_CDN: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 989 | pptp_cdn_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 990 | break; |
| 991 | case PPTP_CTRL_MSG_TYPE_WEN: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 992 | pptp_wen_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 993 | break; |
| 994 | case PPTP_CTRL_MSG_TYPE_SLI: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 995 | pptp_sli_print(ndo, dat); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 996 | break; |
| 997 | default: |
| 998 | /* do nothing */ |
| 999 | break; |
| 1000 | } |
| 1001 | |
| 1002 | return; |
| 1003 | |
| 1004 | trunc: |
Elliott Hughes | 892a68b | 2015-10-19 14:43:53 -0700 | [diff] [blame] | 1005 | ND_PRINT((ndo, "%s", tstr)); |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 1006 | } |