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